This is a portion of a script that has a couple of dialogs in it. When the dialog box is loaded a drop down menu has a list of ini files in it (just the name - not the path or ini extension) and it works correctly.
There is a button to delete one and it is refreshed correctly.
If I add a new ini file when the same subroutine processes the list to remove the .ini and path of the ini file it adds a "0" to the begining and ending of the value. The file list is read correctly and it is the same subroutine only it is generating different results after a dialog box has been opened.
Any ideas?
The portion of the script is below.
GoSub>getllist
SRT>getllist
ReadiniFile>C:\BatchBCCoverCreator\documentidentifer.ini,Path,Profile Path,PP
GetFileList>%PP%\*.ini,files
StringReplace>files,%PP%\,,filelist
StringReplace>filelist,.ini,,filelist
StringReplace>filelist,;,%CRLF%,filelist
END>getllist
Dialog>Dialog1
Caption=Setup Document Sections
Width=400
Height=253
Top=114
Left=1367
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\Setup Document Sections2.bmp,0,0,465,233,msImage1,0
Button=Exit,273,120,89,73,2
ComboBox=msComboBox1,104,64,105,%filelist%
Label=Create a series of barcodes with two fields for document name and type,24,96,true
Label=Select Document Type,216,68,true
Button=Create a New Series Group,24,120,249,25,5
Button=Edit Series,24,144,249,25,4
Button=Delete Series,24,168,249,25,1
Label=Copyright© eDocFile Inc. 2004-2008,113,200,true
EndDialog>Dialog1
Show>Dialog1
Label>Mainloop
If>result=1,DeleteSeries
If>result=2,EOF
If>result=4,editseries
If>result=5,newseries
GetDialogAction>Dialog1,result
Goto>Mainloop
SRT>DeleteSeries
DeleteFile>%PP%\%Dialog1.msComboBox1%.ini
DeleteFile>%PP%\%Dialog1.msComboBox1%.txt
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>DeleteSeries
SRT>newseries
CloseDialog>Dialog1
Dialog>Dialog3
Caption=Dialog3
Width=445
Height=254
Top=114
Left=1367
Label=Enter a Name for this series,152,32,true
Edit=sername,152,56,121,
Label=Enter a List of Document Types,48,88,true
RadioGroup=msRadioGroup1,Select Barcode Type,216,88,185,65,3 of 9%CRLF%Code 128,-1
Button=Create Profile,216,176,75,25,1
Button=Exit,304,176,75,25,2
Memo=msMemo1,48,112,153,89,
EndDialog>Dialog3
Show>Dialog3,rs
Label>seriesloop
If>rs=1,createfile
If>rs=2,donewithit
Goto>seriesloop
Label>createfile
Deletefile>%PP%\%Dialog3.sername%.ini
WriteLn>%PP%\%Dialog3.sername%.ini,result,[Settings]
WriteLn>%PP%\%Dialog3.sername%.ini,result,Barcode Type=%Dialog3.msRadioGroup1%
DeleteFile>%PP%\%Dialog3.sername%,txt
WriteLn>%PP%\%Dialog3.sername%.txt,%Dialog3.msMemo1%
Label>donewithit
CloseDialog>Dialog3
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>newseries
Parsing returning errors on second processing
Moderators: JRL, Dorian (MJT support)
The problem is in the "newseries" subroutine. In the line:
WriteLn>%PP%\%Dialog3.sername%.txt,%Dialog3.msMemo1%
you left out the writeln result variable so the variable %Dialog3.msMemo1% is the result. the result is success or zero and since the variable is set to nul, nul becomes zero. In the "getllist" subroutine you use stringreplace to set the path and .ini to nul which is now zero. Thus you add "0" to the start and end of each of your list items.
Change the line to read:
WriteLn>%PP%\%Dialog3.sername%.txt,wres,%Dialog3.msMemo1%
Also In the "newseries" subroutine you have a line with a comma that I believe needs to be a period (dot).
DeleteFile>%PP%\%Dialog3.sername%,txt
Should be
DeleteFile>%PP%\%Dialog3.sername%.txt
Also your dialog3 dialog block should be moved to a location toward the start of the script such that it will not be repeated. Putting it in the newseries subroutine puts it in a location where the dialog block might be called a second time. This will give an error "Error trying to create dialog: Dialog3".
Hope this is helpful,
Dick
WriteLn>%PP%\%Dialog3.sername%.txt,%Dialog3.msMemo1%
you left out the writeln result variable so the variable %Dialog3.msMemo1% is the result. the result is success or zero and since the variable is set to nul, nul becomes zero. In the "getllist" subroutine you use stringreplace to set the path and .ini to nul which is now zero. Thus you add "0" to the start and end of each of your list items.
Change the line to read:
WriteLn>%PP%\%Dialog3.sername%.txt,wres,%Dialog3.msMemo1%
Also In the "newseries" subroutine you have a line with a comma that I believe needs to be a period (dot).
DeleteFile>%PP%\%Dialog3.sername%,txt
Should be
DeleteFile>%PP%\%Dialog3.sername%.txt
Also your dialog3 dialog block should be moved to a location toward the start of the script such that it will not be repeated. Putting it in the newseries subroutine puts it in a location where the dialog block might be called a second time. This will give an error "Error trying to create dialog: Dialog3".
Hope this is helpful,
Dick
dialog now not refreshing
Thanks for the help.
I have corrected that issue, moved the dialogs to the top and it sort of works. What happens is when you edit the data it works you can call it up again and it has been updated; however, if you want to call up other data you are presented with the first data. I have stepped though it a number of times and I can see the values change to what they are suppose to be but when the dialog is displayed it shows the old data.
It is almost like there needs to be reload or refresh command, like the reset dialog action.
Let>APP_TITLE=Setup Barcode Document Identifer
IfFileExists>C:\BatchBCCoverCreator\documentidentifer.ini
ReadiniFile>C:\BatchBCCoverCreator\documentidentifer.ini,Path,Profile Path,PP
Else
Let>PP=
Endif
Dialog>Dialog3
Caption=Dialog3
Width=373
Height=274
Top=114
Left=1367
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\CreateCoverpages1.bmp,0,0,433,241,msImage1,0
Label=Enter a Name for this series,192,68,true
Edit=sername,24,64,153,%proname%
Label=Enter a List of Document Types,24,96,true
RadioGroup=msRadioGroup1,Select Barcode Type,192,104,145,65,3 of 9%CRLF%Code 128,-1
Button=Create,192,184,75,25,1
Button=Exit,266,184,75,25,2
Memo=msMemo1,24,120,153,89,%memotxt%
Label=Copyright© eDocFile Inc. 2004-2008,80,224,true
EndDialog>Dialog3
Dialog>Profile
Caption=Set Profile Path
Width=463
Height=208
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\Setup Document Sections.bmp,0,0,457,177,msImage1,0
Button=Continue,142,126,75,25,1
Edit=Profilepath,32,72,377,%PP%
Button=Exit,216,126,75,25,2
Label=Copyright© eDocFile Inc. 2004-2008,128,152,true
Button=Browse to folder containing Document Profiles,32,96,377,25,0
FileBrowse=Browse to folder containing Document Profiles,Profilepath,|*.*|,dir
EndDialog>Profile
Dialog>Dialog1
Caption=Setup Document Sections
Width=400
Height=253
Top=114
Left=1367
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\CreateCoverpages1.bmp,0,0,465,233,msImage1,0
Button=Exit,273,120,89,73,2
ComboBox=msComboBox1,104,64,105,%filelist%
Label=Create a series of barcodes with two fields for document name and type,24,96,true
Label=Select Document Type,216,68,true
Button=Create a New Series Group,24,120,249,25,5
Button=Edit Series,24,144,249,25,4
Button=Delete Series,24,168,249,25,1
Label=Copyright© eDocFile Inc. 2004-2008,113,200,true
EndDialog>Dialog1
Label>firstloop
Show>Profile,pr
If>pr=1,createpath
If>pr=2,EOF
Goto>firstloop
Label>createpath
DeleteFile>C:\BatchBCCoverCreator\documentidentifer.ini
WriteLn>C:\BatchBCCoverCreator\documentidentifer.ini,result,[Path]
WriteLn>C:\BatchBCCoverCreator\documentidentifer.ini,result,Profile Path=%Profile.Profilepath%
IfDirExists>%Profile.Profilepath%,havedir
Let>RP_Wait=1
Let>RP_WINDOWMODE=0
RunProgram>cmd /c MD "%Profile.Profilepath%"
CreateDir>%Profile.Profilepath%
Label>havedir
GoSub>getllist
SRT>getllist
ReadiniFile>C:\BatchBCCoverCreator\documentidentifer.ini,Path,Profile Path,PP
GetFileList>%PP%\*.ini,files
StringReplace>files,%PP%\,,filelist
StringReplace>filelist,.ini,,filelist
StringReplace>filelist,;,%CRLF%,filelist
END>getllist
Show>Dialog1
Label>Mainloop
If>result=1,DeleteSeries
If>result=2,EOF
If>result=4,editseries
If>result=5,newseries
GetDialogAction>Dialog1,result
Goto>Mainloop
SRT>DeleteSeries
DeleteFile>%PP%\%Dialog1.msComboBox1%.ini
DeleteFile>%PP%\%Dialog1.msComboBox1%.txt
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>DeleteSeries
SRT>newseries
Let>proname=
Let>memotxt=
GoSub>createandedit
END>newseries
SRT>editseries
Let>proname=%Dialog1.msComboBox1%
ReadFile>%PP%\%Dialog1.msComboBox1%.txt,memotxt
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
GoSub>createandedit
End>editseries
SRT>createandedit
CloseDialog>Dialog1
Show>Dialog3,rs
Label>seriesloop
If>rs=1,createfile
If>rs=2,donewithit
GetDialogAction>Dialog3
Goto>seriesloop
Label>createfile
Deletefile>%PP%\%Dialog3.sername%.ini
WriteLn>%PP%\%Dialog3.sername%.ini,result,[Settings]
WriteLn>%PP%\%Dialog3.sername%.ini,result,Barcode Type=%Dialog3.msRadioGroup1%
DeleteFile>%PP%\%Dialog3.sername%.txt
WriteLn>%PP%\%Dialog3.sername%.txt,result,%Dialog3.msMemo1%
Label>donewithit
ResetDialogAction>Dialog3
CloseDialog>Dialog3
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>createandedit
Label>EOF
I have corrected that issue, moved the dialogs to the top and it sort of works. What happens is when you edit the data it works you can call it up again and it has been updated; however, if you want to call up other data you are presented with the first data. I have stepped though it a number of times and I can see the values change to what they are suppose to be but when the dialog is displayed it shows the old data.
It is almost like there needs to be reload or refresh command, like the reset dialog action.
Let>APP_TITLE=Setup Barcode Document Identifer
IfFileExists>C:\BatchBCCoverCreator\documentidentifer.ini
ReadiniFile>C:\BatchBCCoverCreator\documentidentifer.ini,Path,Profile Path,PP
Else
Let>PP=
Endif
Dialog>Dialog3
Caption=Dialog3
Width=373
Height=274
Top=114
Left=1367
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\CreateCoverpages1.bmp,0,0,433,241,msImage1,0
Label=Enter a Name for this series,192,68,true
Edit=sername,24,64,153,%proname%
Label=Enter a List of Document Types,24,96,true
RadioGroup=msRadioGroup1,Select Barcode Type,192,104,145,65,3 of 9%CRLF%Code 128,-1
Button=Create,192,184,75,25,1
Button=Exit,266,184,75,25,2
Memo=msMemo1,24,120,153,89,%memotxt%
Label=Copyright© eDocFile Inc. 2004-2008,80,224,true
EndDialog>Dialog3
Dialog>Profile
Caption=Set Profile Path
Width=463
Height=208
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\Setup Document Sections.bmp,0,0,457,177,msImage1,0
Button=Continue,142,126,75,25,1
Edit=Profilepath,32,72,377,%PP%
Button=Exit,216,126,75,25,2
Label=Copyright© eDocFile Inc. 2004-2008,128,152,true
Button=Browse to folder containing Document Profiles,32,96,377,25,0
FileBrowse=Browse to folder containing Document Profiles,Profilepath,|*.*|,dir
EndDialog>Profile
Dialog>Dialog1
Caption=Setup Document Sections
Width=400
Height=253
Top=114
Left=1367
Max=0
Min=0
Close=1
Resize=0
Image=C:\BatchBCCoverCreator\CreateCoverpages1.bmp,0,0,465,233,msImage1,0
Button=Exit,273,120,89,73,2
ComboBox=msComboBox1,104,64,105,%filelist%
Label=Create a series of barcodes with two fields for document name and type,24,96,true
Label=Select Document Type,216,68,true
Button=Create a New Series Group,24,120,249,25,5
Button=Edit Series,24,144,249,25,4
Button=Delete Series,24,168,249,25,1
Label=Copyright© eDocFile Inc. 2004-2008,113,200,true
EndDialog>Dialog1
Label>firstloop
Show>Profile,pr
If>pr=1,createpath
If>pr=2,EOF
Goto>firstloop
Label>createpath
DeleteFile>C:\BatchBCCoverCreator\documentidentifer.ini
WriteLn>C:\BatchBCCoverCreator\documentidentifer.ini,result,[Path]
WriteLn>C:\BatchBCCoverCreator\documentidentifer.ini,result,Profile Path=%Profile.Profilepath%
IfDirExists>%Profile.Profilepath%,havedir
Let>RP_Wait=1
Let>RP_WINDOWMODE=0
RunProgram>cmd /c MD "%Profile.Profilepath%"
CreateDir>%Profile.Profilepath%
Label>havedir
GoSub>getllist
SRT>getllist
ReadiniFile>C:\BatchBCCoverCreator\documentidentifer.ini,Path,Profile Path,PP
GetFileList>%PP%\*.ini,files
StringReplace>files,%PP%\,,filelist
StringReplace>filelist,.ini,,filelist
StringReplace>filelist,;,%CRLF%,filelist
END>getllist
Show>Dialog1
Label>Mainloop
If>result=1,DeleteSeries
If>result=2,EOF
If>result=4,editseries
If>result=5,newseries
GetDialogAction>Dialog1,result
Goto>Mainloop
SRT>DeleteSeries
DeleteFile>%PP%\%Dialog1.msComboBox1%.ini
DeleteFile>%PP%\%Dialog1.msComboBox1%.txt
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>DeleteSeries
SRT>newseries
Let>proname=
Let>memotxt=
GoSub>createandedit
END>newseries
SRT>editseries
Let>proname=%Dialog1.msComboBox1%
ReadFile>%PP%\%Dialog1.msComboBox1%.txt,memotxt
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
GoSub>createandedit
End>editseries
SRT>createandedit
CloseDialog>Dialog1
Show>Dialog3,rs
Label>seriesloop
If>rs=1,createfile
If>rs=2,donewithit
GetDialogAction>Dialog3
Goto>seriesloop
Label>createfile
Deletefile>%PP%\%Dialog3.sername%.ini
WriteLn>%PP%\%Dialog3.sername%.ini,result,[Settings]
WriteLn>%PP%\%Dialog3.sername%.ini,result,Barcode Type=%Dialog3.msRadioGroup1%
DeleteFile>%PP%\%Dialog3.sername%.txt
WriteLn>%PP%\%Dialog3.sername%.txt,result,%Dialog3.msMemo1%
Label>donewithit
ResetDialogAction>Dialog3
CloseDialog>Dialog3
GoSub>getllist
Let>DIALOG1.MSCOMBOBOX1.ITEMS.TEXT=%filelist%
ResetDialogAction>Dialog1
Show>Dialog1
End>createandedit
Label>EOF
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You need to call ResetDialogAction whenever you want to update the dialog with changes. I can see one place where you are setting some dialog values but not calling ResetDialogAction:
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
GoSub>createandedit
Subroutine createandedit does a Show>Dialog3,rs but fails to use ResetDialogAction. So those changes above won't be published.
There may be other similar omissions but I haven't looked much more closely than that.
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
GoSub>createandedit
Subroutine createandedit does a Show>Dialog3,rs but fails to use ResetDialogAction. So those changes above won't be published.
There may be other similar omissions but I haven't looked much more closely than that.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Resetting a Dialog with a counter
Marcus
I fixed it by adding a counter, so the first time it loads normally and on each subsuquent load it is reset.
SRT>editseries
Let>x=x+1
Let>proname=%Dialog1.msComboBox1%
ReadFile>%PP%\%Dialog1.msComboBox1%.txt,memotxt
If>x>1
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
ResetDialogAction>Dialog3
Endif
GoSub>createandedit
End>editseries
I fixed it by adding a counter, so the first time it loads normally and on each subsuquent load it is reset.
SRT>editseries
Let>x=x+1
Let>proname=%Dialog1.msComboBox1%
ReadFile>%PP%\%Dialog1.msComboBox1%.txt,memotxt
If>x>1
let>DIALOG3.SERNAME=%proname%
let>DIALOG3.MSMEMO1=%memotxt%
ResetDialogAction>Dialog3
Endif
GoSub>createandedit
End>editseries