The script below opens a menu where a user can select new or open
New Works fine
Open opens the second window which has 5 combo boxes each with the same list. The script reads a value and attempts to make it the selected value in the ComboBox with the use of Itemindex.
The values are correctly read and the index is set to the right value as displayed in the Watch List; however, when the Show>dialog comes around all values (as displayed in the watch list) are reset to -1.
Any Ideas as to why?
Let>APP_TITLE=Command Line Setup
/*
Compile to C:\consolegrab\Scanning\Scanning Setup.exe
*/
GetFileList>C:\consolegrab\Scanning\*.ini,files
StringReplace>files,C:\consolegrab\Scanning\,,filelist
StringReplace>filelist,;,%CRLF%,filelist
StringReplace>filelist,.ini,,filelist
Dialog>Dialog1
Caption=Open Profile
Width=335
Height=214
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=Console Capture Profile Manager,91,61,true
Label=Copyright© eDocFile Inc. 2004-2007,82,160,true
ComboBox=Profilechoicecombo,96,84,145,%filelist%
Button=Open,112,122,57,25,1
Button=Exit,224,122,57,25,2
Button=Delete,168,122,57,25,3
Image=C:\consolegrab\Images\scanningprofilemanager.bmp,0,0,329,57
Button=New,53,122,57,25,4
EndDialog>Dialog1
Label>Displaydialog1
Show>Dialog1,r
If>r=2,finish
If>r=1,OpenProfile
If>r=3,RemoveProfile
If>r=4,new
Goto>Displaydialog1
Label>OpenProfile
Let>Jobnamebox=%Dialog1.Profilechoicecombo%
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,Profile to use,selectedprofile
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,Root Directory,RootDirBox
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,Directory1,dir1value
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,Directory2,dir2value
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,Directory3,dir3value
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,File Name1,file1value
ReadIniFile>C:\consolegrab\Scanning\%Jobnamebox%.ini,Job Settings,File Name2,file2value
Let>firstrun=YES
Gosub>Loadchozenfields
GoSub>Loadlist
Goto>Scanningsetup
Label>new
let>availablefields=
Let>RootDirBox=
Let>Jobnamebox=
Let>selectedprofile=
Goto>Scanningsetup
Label>RemoveProfile
DeleteFile>C:\consolegrab\Scanning\%Dialog1.Profilechoicecombo%.ini
Goto>finish
Label>Scanningsetup
Dialog>Dialog2
Caption=Setup Command line output
Width=517
Height=412
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Edit=jobname,151,72,121,Jobnamebox
Label=Name this Job,279,75,true
Edit=rootdir,101,166,393,%RootDirBox%
Edit=Profileselected,132,106,349,%selectedprofile%
Button=Browse to Profile,16,104,109,25,0
Label=________________________________ Folder Structure ________________________________,26,141,true
Button=Exit,250,320,75,25,2
Button=Continue,176,320,75,25,1
Image=C:\consolegrab\Images\setupScanning.bmp,0,0,513,57
ComboBox=Dir1,22,214,145,%availablefields%
ComboBox=Dir2,186,214,145,%availablefields%
ComboBox=Dir3,350,214,145,%availablefields%
Label=\,174,218,true
Label=\,338,216,true
Label=Root Directory,23,170,true
Label=Sub Directorys,224,194,true
Label=________________________________ File Naming ________________________________,26,253,true
ComboBox=File1,88,280,145,%availablefields%
ComboBox=File2,256,280,145,%availablefields%
Label=-,244,284,true
Label=Copyright© eDocFile Inc. 2004-2007,172,360,true
FileBrowse=Browse to Profile,Profileselected,ini files (*.ini)|*.ini,open,C:\consolegrab\ProfileManager\
EndDialog>Dialog2
Show>Dialog2
Label>MainLoop
GetDialogAction>Dialog2,result
Length>%Dialog2.Profileselected%,testprofile
If>%testprofile%>0,getlist
If>result=2,finish
If>result=1,Continue
Wait>0.5
Goto>MainLoop
Label>Continue
Let>job=%Dialog2.jobname%.ini
IfFileExists>C:\consolegrab\Scanning\%job%
DeleteFile>C:\consolegrab\Scanning\%job%
Endif
WriteLn>C:\consolegrab\Scanning\%job%,result,[Job Settings]
WriteLn>C:\consolegrab\Scanning\%job%,result,Profile to use=%Dialog2.Profileselected%
WriteLn>C:\consolegrab\Scanning\%job%,result,Root Directory=%Dialog2.rootdir%
WriteLn>C:\consolegrab\Scanning\%job%,result,Directory1=%Dialog2.Dir1%
WriteLn>C:\consolegrab\Scanning\%job%,result,Directory2=%Dialog2.Dir2%
WriteLn>C:\consolegrab\Scanning\%job%,result,Directory3=%Dialog2.Dir3%
WriteLn>C:\consolegrab\Scanning\%job%,result,File Name1=%Dialog2.File1%
WriteLn>C:\consolegrab\Scanning\%job%,result,File Name2=%Dialog2.File2%
SRT>getlist
IF>update=YES
Let>completestring=%selectedprofile%
Else
Let>completestring=%Dialog2.Profileselected%
Endif
StringReplace>%completestring%,C:\consolegrab\ProfileManager\,,completestring
StringReplace>%completestring%,.ini,,profilename
IfFileExists>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt
Let>variablelist=
Let>k=1
Label>startgetlist
ReadLn>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt,k,variablechoice
If>variablechoice=##EOF##,finishit
Separate>%variablechoice%,=,variable_read
ConCat>variablelist,%variable_read_1%
ConCat>variablelist,%CRLF%
Let>k=k+1
Goto>startgetlist
Label>finishit
Let>DIALOG2.Dir1.ITEMS.TEXT=%variablelist%
Let>DIALOG2.Dir2.ITEMS.TEXT=%variablelist%
Let>DIALOG2.Dir3.ITEMS.TEXT=%variablelist%
Let>DIALOG2.File1.ITEMS.TEXT=%variablelist%
Let>DIALOG2.File2.ITEMS.TEXT=%variablelist%
IF>update=YES,skipupdate
ResetDialogAction>Dialog2
Label>skipupdate
Endif
End>getlist
///_______________________________Load Fields___________________________
SRT>Loadlist
StringReplace>%selectedprofile%,C:\consolegrab\ProfileManager\,,completestring
StringReplace>%completestring%,.ini,,profilename
IfFileExists>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt,rungetpos,skiprunpos
Label>skiprunpos
Let>dirindex1=0
Let>dirindex2=0
Let>dirindex3=0
Let>fileindex1=0
Let>fileindex2=0
Goto>finishpos
Label>rungetpos
Length>%dir1value%,checkit
If>%checkit%>0
Let>checkvalue=%dir1value%
GoSub>findpos
Let>DIALOG2.Dir1.ITEMINDEX=%k%
Let>k=0
Else
Let>DIALOG2.Dir1.ITEMINDEX=0
Endif
Length>%dir2value%,checkit
If>%checkit%>0
Let>checkvalue=%dir2value%
GoSub>findpos
Let>DIALOG2.Dir2.ITEMINDEX=%k%
Let>k=0
Else
Let>DIALOG2.Dir2.ITEMINDEX=0
Endif
Length>%dir3value%,checkit
If>%checkit%>0
Let>checkvalue=%dir3value%
GoSub>findpos
Let>DIALOG2.Dir3.ITEMINDEX=%k%
Let>k=0
Else
Let>DIALOG2.Dir3.ITEMINDEX=0
Endif
Length>%file1value%,checkit
If>%checkit%>0
Let>checkvalue=%file1value%
GoSub>findpos
Let>DIALOG2.File1.ITEMINDEX=%k%
Let>k=0
Else
Let>DIALOG2.File1.ITEMINDEX=0
Endif
Length>%file2value%,checkit
If>%checkit%>0
Let>checkvalue=%file2value%
GoSub>findpos
Let>DIALOG2.File2.ITEMINDEX=%k%
Let>k=0
Else
Let>DIALOG2.File2.ITEMINDEX=0
Endif
End>Loadlist
SRT>findpos
Let>variablelist=
Let>k=0
Label>startgetpos
ReadLn>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt,k,variablechoice
If>variablechoice=##EOF##,finishpos
Separate>%variablechoice%,=,variable_read
If>%variable_read_1%=%checkvalue%
Goto>finishpos
Endif
Let>k=k+1
Goto>startgetpos
Label>finishpos
End>findpos
SRT>Loadchozenfields
StringReplace>%selectedprofile%,C:\consolegrab\ProfileManager\,,completestring
StringReplace>%completestring%,.ini,,profilename
IfFileExists>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt
Let>variablelist=
Let>k=1
Label>selecedlist
ReadLn>C:\consolegrab\ProfileManager\Mapped Fields\%profilename%_fieldslist.txt,k,variablechoice
If>variablechoice=##EOF##,finishselecedlist
Separate>%variablechoice%,=,variable_read
ConCat>variablelist,%variable_read_1%
ConCat>variablelist,%CRLF%
Let>k=k+1
Goto>selecedlist
Label>finishselecedlist
Endif
End>Loadchozenfields
Label>EOF
Label>finish
Setting Combo Box with .itemIndex
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Are you sure you're doing a ResetDialogAction after changing the values and before the next Show?
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?
Difficulty with combo box
Marcus,
I did not use the ResetDialog Action as the Dialog box has not been shown. (therefore there is nothing to reset - I tried that) This is only loaded once, it is reading a list of values from a configeration file.
So, the index number is determined before the Show command, however, right after the show command is Get Dialog Action. Could that be it? and how would I change it.
I did not use the ResetDialog Action as the Dialog box has not been shown. (therefore there is nothing to reset - I tried that) This is only loaded once, it is reading a list of values from a configeration file.
So, the index number is determined before the Show command, however, right after the show command is Get Dialog Action. Could that be it? and how would I change it.