Source language: Translate to:

code help

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

code help

Postby stevec » Tue Feb 17, 2015 8:14 am

I am in the process to archiving and backing up some applications.

What I am trying to do is seperate the files for the individual app into it own seperate folder, using the file list to identify and copy the files.

One problem that I have is a huge folder with a number of sub folders with various images/buttons/etc.
I have been using the file list to help, but thought writing a simple code might be better.

I cut and paste from the files list and get a section into a seperate txt file.

FileOpenBox "Open file" "Any File|*.*" "" "[file1]" ""
FileToVar "[file1]" "[list]"

Then the list is displayed in a text entry multiline list.

Here is where I lose it. I need the list to be put into a variable to be copied.

Here is a section of the files list

*******************

F:\BatchFiles\1.ico
F:\BatchFiles\1_0_8.bmp
F:\NeoBook 5\Buttons\Steve\Red150.bmp
F:\NeoBook 5\Buttons\Steve\Yellow150.bmp
F:\NeoBook 5\Buttons\Steve\OrangeSun150.bmp
F:\NeoBook 5\Buttons\Steve\LtBlue150B.bmp
F:\NeoBook 5\Buttons\Steve\Gold150.bmp
F:\NeoBook 5\Buttons\Steve\Purple150.bmp
F:\NeoBook 5\Buttons\Steve\Pink150.bmp
F:\NeoBook 5\Buttons\Steve\MedBlue150.bmp
F:\NeoBook 5\Buttons\Steve\GreenSubLime150.bmp

******************************

here is what I need to run

XCopy "F:\BatchFiles\1.ico "C:\Temp2\MSIFiles"
XCopy "F:\BatchFiles\1_0_8.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\Red150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\Yellow150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\OrangeSun150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\LtBlue150B.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\Gold150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\Purple150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\Pink150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\MedBlue150.bmp" "C:\Temp2\MSIFiles"
XCopy "F:\NeoBook 5\Buttons\Steve\GreenSubLime150.bmp" "C:\Temp2\MSIFiles"

******************************

I have a batch file that I created adding the 'replace' option in Notepad, and the "C:\Temp2\MSIFiles" can be a variable.

question:

How to get the list to run?

I have tried the following

Run "xcopy" "[#34][list][#34] [#34]C:\Temp2\MSIFiles\[#34]" "RunOnce" "Normal" ""

thoughts, ideas.

Thanks;
Steve
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: code help

Postby Gaev » Tue Feb 17, 2015 11:26 am

Steve:

Take a look here at the options available with the xcopy command .... especially the /s switch that lets you copy all directories and subdirectories.

So if you do something like ...
Code: Select all
FileWrite "[PubDir]temp.bat" "All" "!XCOPY [sourceFolder]\*.* [destinationFolder] /S"
Run "[PubDir]temp.bat" "" "" "" ""


You can also ...

1) invoke the DOS command dir (with the /B and /S switches ... and the > filelist.txt output directive to have it output a list of the files to filelist.txt

2) read the filelist.txt file into a NeoBook variable

3) StrParse the contents of the variable into an array (one item per line ending in [#13][#10])

4) do a FileCopy inside a Loop/EndLoop code block
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: code help

Postby stevec » Tue Feb 17, 2015 12:06 pm

Gaev
Thanks for the reply.
It's not a folder that I'm trying to copy but individual files.

The source iss Neobook's file list.

***************Neobook File List*****************

Publication File List (95 files)

Publication:
F:\BatchFiles\MSI22015B.pub

Text:
F:\BatchFiles\EmbeddedFiles\WhoRan.txt

Images:
F:\BatchFiles\1.ico
F:\BatchFiles\1_0_8.bmp
F:\NeoBook 5\Buttons\Steve\Red150.bmp
F:\NeoBook 5\Buttons\Steve\Yellow150.bmp
F:\NeoBook 5\Buttons\Steve\OrangeSun150.bmp
F:\NeoBook 5\Buttons\Steve\LtBlue150B.bmp
F:\NeoBook 5\Buttons\Steve\Gold150.bmp
F:\NeoBook 5\Buttons\Steve\Purple150.bmp
F:\NeoBook 5\Buttons\Steve\Pink150.bmp
F:\NeoBook 5\Buttons\Steve\MedBlue150.bmp
F:\NeoBook 5\Buttons\Steve\GreenSubLime150.bmp
F:\BatchFiles\MSI.png
F:\NeoBook 5\Buttons\150x30\Magenta150.bmp
F:\NeoBook 5\Buttons\Steve\LtGreen150.bmp
F:\NeoBook 5\Buttons\150x30\Moonstone150.bmp
F:\Patterns\Tiles\boomerang-teal2.gif
F:\NeoBook 5\Buttons\Steve\Magenta100x25.bmp
F:\NeoBook 5\Buttons\Steve\Pink100x25.bmp
F:\NeoBook 5\Buttons\Steve\Red100x25.bmp
F:\NeoBook 5\Buttons\Steve\OrangeMed100x25.bmp
F:\NeoBook 5\Buttons\Steve\LtSeaGreen100x25.bmp
F:\NeoBook 5\Buttons\Steve\MintGreen150.bmp
F:\NeoBook 5\Buttons\Steve\Teal100x25.bmp
F:\NeoBook 5\Buttons\Steve\LtPurple100x25.bmp
F:\NeoBook 5\Buttons\Steve\Salmon100x25.bmp
F:\NeoBook 5\Buttons\Steve\OrangeRed100.bmp
F:\NeoBook 5\Buttons\Steve\OrangeRed100x25.bmp
F:\NeoBook 5\Buttons\Steve\Purple100x25.bmp
F:\NeoBook 5\Buttons\Steve\Lavender100x25.bmp
F:\NeoBook 5\Buttons\Steve\Salmon60x25.bmp
F:\NeoBook 5\Buttons\Steve\Magenta60x25.bmp
F:\NeoBook 5\Buttons\Steve\Salmon150.bmp
F:\NeoBook 5\Buttons\Steve\Aqua150.bmp
F:\NeoBook 5\Buttons\Steve\LtBlue100x25.bmp
F:\BatchFiles\PDS.png
F:\NeoBook 5\Buttons\100x30\LtGreen100x30.bmp
F:\NeoBook 5\Buttons\100x25\LtBlue100x25.bmp
F:\NeoBook 5\Buttons\100x25\Magenta100x25.bmp
F:\NeoBook 5\Buttons\100x25\LtSeaGreen100x25.bmp
F:\NeoBook 5\Buttons\100x25\Yellow100x25.bmp
F:\NeoBook 5\Buttons\100x25\Salmon100x25.bmp
F:\NeoBook 5\Buttons\100x25\Red100x25.bmp
F:\Patterns\Tiles\boomerang-coral-reef.gif
F:\NeoBook 5\Buttons\Steve\Purple150C.bmp
F:\NeoBook 5\Buttons\Steve\Magenta150.bmp
F:\NeoBook 5\Buttons\Steve\Orange150.bmp
F:\NeoBook 5\Buttons\Steve\LtBlue150.bmp
F:\NeoBook 5\Buttons\Steve\Teal150.bmp
F:\NeoBook 5\Buttons\Steve\RunIt4BMP.bmp
F:\BatchFiles\Inspector.png
F:\BatchFiles\Building.png
F:\Patterns\Tiles\boomerang-succatash.gif
F:\NeoBook 5\Buttons\Steve\SpringGreen150.bmp
F:\NeoBook 5\Buttons\Steve\LtSeaGreen150.bmp
F:\NeoBook 5\Buttons\Steve\Gray150.bmp
F:\NeoBook 5\Buttons\Steve\OrangeRed150.bmp
F:\NeoBook 5\Buttons\Steve\Purple150B.bmp
F:\NeoBook 5\Buttons\Steve\MintGreen100x30.bmp
F:\NeoBook 5\Buttons\Steve\Tan100x30.bmp
F:\NeoBook 5\Buttons\Steve\Orange75x30.bmp
F:\NeoBook 5\Buttons\Steve\CherryRed150.bmp
F:\BatchFiles\PW.png
F:\Patterns\Tiles\eames-teal1128.gif
F:\NeoBook 5\Buttons\Steve\Green150.bmp
F:\BatchFiles\Office.png
F:\Patterns\Tiles\winkleperry.jpg
F:\NeoBook 5\Buttons\Steve\Magenta60.bmp
F:\NeoBook 5\Buttons\Steve\Tan150.bmp
F:\BatchFiles\ODBC.png
F:\Backgrounds\Aqua Modern Geometric.jpg
F:\NeoBook 5\Buttons\150x30\Coral150.bmp
F:\NeoBook 5\Buttons\150x30\Dijon150.bmp
F:\Patterns\Tiles\jazzy-24.gif
F:\BatchFiles\AppWareFrontEnd\SoftwareByTheWizard.png
F:\WizardWarePub\WizardLogoNoWords.gif

Sound/Music:
None

Video/Animation:
None

Flash Files:
None

HTML Files:
None

Fonts:
MS Sans Serif **
Arial (arial.ttf)

Help Files:
None

Function library files:
None

External Applications:
F:\BatchFiles\EmbeddedFiles\BCFonts.bat
F:\BatchFiles\EmbeddedFiles\dis.bat
F:\BatchFiles\EmbeddedFiles\hstart.exe
F:\BatchFiles\EmbeddedFiles\sndisc.bat

Miscellaneous:
F:\BatchFiles\EmbeddedFiles\2XSettings.2xc
F:\BatchFiles\EmbeddedFiles\BCFonts.reg
F:\BatchFiles\EmbeddedFiles\disProd.js
F:\BatchFiles\EmbeddedFiles\IESet.reg
F:\BatchFiles\EmbeddedFiles\MHC.reg
F:\BatchFiles\EmbeddedFiles\pplan.ini
F:\BatchFiles\EmbeddedFiles\snc_discovery.js.kep
F:\BatchFiles\EmbeddedFiles\snc_discovery.js
F:\BatchFiles\EmbeddedFiles\Tidemark.reg
F:\BatchFiles\EmbeddedFiles\TidemarkCombined.reg

Required Plug-Ins:
F:\NeoBook 5\PlugIns\lgaDialog.nbp
F:\NeoBook 5\PlugIns\lgaFileSys.nbp

Plug-In Dependant Files:
None

***************************END**************************


What I am trying to do is to capture the files in the above list and then copy the files into a seperate folder. Sorry if I confused what I am attempting.

for example I copy and paste the Image section to a seperate text file

F:\BatchFiles\1.ico
F:\BatchFiles\1_0_8.bmp
F:\NeoBook 5\Buttons\Steve\Red150.bmp
F:\NeoBook 5\Buttons\Steve\Yellow150.bmp
F:\NeoBook 5\Buttons\Steve\OrangeSun150.bmp
F:\NeoBook 5\Buttons\Steve\LtBlue150B.bmp
F:\BatchFiles\PW.png

These are the files that I would like copied to a seperate folder. In this case it was called MSIFiles.

The routine that I am trying is for the list to be xcopied to that folder. Since the list has items from different folders, copying the folder would get everything and not just the files listed in the individual app (pub).


Hope this clears up some confusion on my part.
Thanks;
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: code help

Postby Gaev » Tue Feb 17, 2015 1:34 pm

Steve:

Perhaps I misunderstood your first post.

Say you have the list of files in myList.txt ... try this
Code: Select all
FileToVar "[PubDir]myList.txt" "[filesList1]"
StrReplace "[filesList1]" "!F:\" "!XCopy "F:\" "[filesList2]" ""
SetVar "[suffixString]" " [#34]C:\Temp2\MSIFiles[#34]"
StrReplace "[filesList2]" "![#13][#10]" "![suffixString][#13][#10]" "[filesList3]" ""
FileWrite "[PubDir]myXCOPYCommands.bat" "All" "[fileList3]"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: code help

Postby dec » Tue Feb 17, 2015 1:35 pm

Hello,

A first approach can be to iterate over the publication files list and then check if the "current" line represent a valid source file path. Something like this, for example:

Syntax: [ Download ] [ Hide ]
Using Neobook Syntax Highlighting
.Let to choose the backup target folder
FolderBox "Select the destination backup directory:" "[TargetDirPath]"

.Check the existence of the target folder
FolderExists "[TargetDirPath]" "[TargetFolderExists]"

.And if the target directory do not exists...
If "[TargetFolderExists]" "=" "False"
  .Note that CreateFolder force the directory tree creation if needed
  CreateFolder "[TargetDirPath]"
EndIf

.Optionally add a "Backup" subdirectory to the target directory path
SetVar "[TargetDirPath]" "[TargetDirPath]\Backup"

.Parse the publication file list contents, that, in this case, has been raw pasted into a TextEntry control
StrParse "[PubFileListTextEntry]" "[#13]" "[PubFileListLines]" "[PubFileListLinesCount]"

.Iterate over all the lines of the publication list file contents
Loop "1" "[PubFileListLinesCount]" "[I]"

  .Trim the current line: yes, here I use npTrimStr from my npUtil plugin
  npTrimStr "[PubFileListLines[I]]" "[SourceFilePath]"
 
  .Check if this particular line conform a valid source file path
  FileExists "[SourceFilePath]" "[SourceFilePathExists]"

  .If the source file exists, we go ahead preparing the appropiate target file
  If "[SourceFilePathExists]" "=" "True"

    .Get the name of the file
    ExtractFileName "[SourceFilePath]" "[TargetFileName]"
   
    .Get the drive of the file
    ExtractFileDrive "[SourceFilePath]" "[SourceFileDrive]"
   
    .Get the path of the file
    ExtractFilePath "[SourceFilePath]" "[TargetFilePath]"
   
    .Remove the drive from the file to get only their directory tree
    StrReplace "[TargetFilePath]" "[SourceFileDrive]" "" "[TargetFileDirTree]" ""
   
    .Create the target file directory based on the source file directory tree
    CreateFolder "[TargetDirPath][TargetFileDirTree]"
   
    .Check if the target directory has been created
    FolderExists "[TargetDirPath][TargetFileDirTree]" "[TargetFolderExists]"

    If "[TargetFolderExists]" "=" "True"
      .And finally copy the source file into the target file
      FileCopy "[SourceFilePath]" "[TargetDirPath][TargetFileDirTree][TargetFileName]"
    Else
      AlertBox "Error" "Sorry, I can't create the target directory:||[TargetFolderExists]||Are you sure the permissions are ok?"
      Return
    EndIf
   
  EndIf
EndLoop

.Congratulations!
AlertBox "Backup complete!" "The backup has been completed."
Run "explorer.exe" "[TargetDirPath]" "Normal" "" ""
Parsed in 0.011 seconds, using GeSHi 1.0.8.10


I prepare a publication sample which use the above code, just remember that we use the "npTrimStr" action from my npUtils plugin. Download the sample publication following this link: short.cz/A

Hope this can be help you in some manner. ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: code help

Postby stevec » Tue Feb 17, 2015 2:09 pm

Thanks;

Here is what I have


*****************Code Below******************


NBW Publication Source File
(C)1993-2007 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5.54
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
SubroutineAction=:Loop¶FileCopy "[list]" "[save]"¶Return
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
Variables=[#10]¶[#13]¶[#34]¶[file1]¶[file2]¶[list#]¶[list]¶[save]¶
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=9
Name=TextEntry2
X=220
Y=20
W=73
H=45
Anchor=0
VarName=[file2]
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=9
Name=TextEntry3
X=37
Y=79
W=538
H=135
Anchor=0
VarName=[list]
EditMultiLine=Yes
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=9
Name=TextEntry4
X=504
Y=229
W=73
H=45
Anchor=0
VarName=[list#]
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=PushButton10
X=39
Y=14
W=168
H=55
Anchor=0
Text=Read file
Align=2
ImageStyle=0
ObjAction=FileOpenBox "Open file" "Any File|*.*" "" "[file1]" ""¶FolderBox "Select a Folder:" "[save]"¶FileLen "[file1]" "[file2]"¶FileToVar "[file1]" "[list]"¶StrParse "[list]" "[#13][#10]" "[file#]" "[list#]"¶..GoSub "Loop"¶Loop "1" "[list#]" "[thisLine]"¶ FileCopy "[file#[thisLine]]" "[save]"¶ ...found a match; add to [SearchResults]¶ .SetVar "[SearchResults]" "[SearchResults][NamesArray[thisLine]][#13][#10]"¶ EndIf¶EndLoop
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1


*******************end code**********************

the list box populates correctly, now just getting the individual lines IE: file#1 thru file#75 to a variable that the file copy can accept. :x :x :x :x :x

Gaev;
I tried your code and it says expression missing. I am playing around with it.

Dec;
I will spend time with the code.



Thanks;
Steve
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: code help

Postby dec » Tue Feb 17, 2015 2:34 pm

Hello,

stevec wrote:Dec;
I will spend time with the code.


Remember the sample I prepare include also the binary program: short.cz/A. I just try now here in my Windows 10 laptop and they works like expected trying to backup certain sample publication. Of course probably the sample is not perfect, but maybe you can get something useful about. ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: code help

Postby Gaev » Tue Feb 17, 2015 3:01 pm

Steve:
Gaev;
I tried your code and it says expression missing. I am playing around with it.

Probably some kind of syntax error ... look at the Debugger and post the offending command.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: code help

Postby stevec » Tue Feb 17, 2015 3:11 pm

dec;

simple words - I'm blown away. It's awesome. Your pub file works like a champ. you need to post it. really.


Gaev;

+ FileToVar "[PubDir]MSIImagesList.txt" "[filesList1]"
+ StrReplace "[filesList1]" "!F:\" "!XCopy " "[fileslist2 ]" ""
+ SetVar "[suffixString]" " [#34]C:\Temp2\MSIFiles[#34]"
+ StrReplace "[filesList2]" "![#13][#10]" "![suffixString][#13][#10]" "[filesList3]" ""
+ FileWrite "[PubDir]myXCOPYCommands.bat" "All" "[fileList3]"

I changed the file name, but the bat file is empty.
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: code help

Postby stevec » Tue Feb 17, 2015 3:23 pm

I am really amazed at the talent here from Dec and Gaev.

I wish I had a better grasp on the coding part.

I will still struggle and see if I can get the code to work. It will help better understand the process behind it.

many many thanks;'
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: code help

Postby Gaev » Tue Feb 17, 2015 10:05 pm

Steve:

This line has a typo in it ...
Code: Select all
FileWrite "[PubDir]myXCOPYCommands.bat" "All" "[fileList3]"

... it should read ...
Code: Select all
FileWrite "[PubDir]myXCOPYCommands.bat" "All" "[filesList3]"

... the variable [filesList3] was missing an s.

Also, you had some other typos ... here is the corrected code ...
Code: Select all
FileToVar "[PubDir]myList.txt" "[filesList1]"
StrReplace "[filesList1]" "!F:\" "!XCOPY F:\" "[filesList2]" ""
SetVar "[suffixString]" "! [#34]C:\Temp2\MSIFiles[#34]"
StrReplace "[filesList2]" "![#13][#10]" "![suffixString][#13][#10]" "[filesList3]" ""
FileWrite "[PubDir]myXCOPYCommands.bat" "All" "[fileList3]"


I wish I had a better grasp on the coding part.
I will still struggle and see if I can get the code to work. It will help better understand the process behind it.

In my suggested code, you ...

a) load your file into [filesList1]

b) replace the F:\" (in each line) with XCOPY F:\" ... the resulting text is in [filesList2]

c) replace the "new line characters" [#13][#10] with [suffixString][#13][#10] ... with the resulting text in [filesList3] ... so you end up appending " [#34]C:\Temp2\MSIFiles[#34]" to the end of every line ... note: [#34] is code for the double quotes ... you use this code because you can not use the double quotes " inside the double quotes that mark the end of the parameter.

d) you write out the contents of [filesList3] to the .bat file

If you run into problems, use NeoBook's Debugger to examine the values in each of the variables to see if they contain the expected data.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: code help

Postby stevec » Wed Feb 18, 2015 6:41 am

awesome!
Thanks; trying it
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 0 guests

cron