Help setting default folder for dialog browse

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Help setting default folder for dialog browse

Post by kpassaur » Mon Mar 31, 2008 11:57 am

I am trying to set a default directory for a file dialog browse, I looked at the help file and came up with this line

Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings

Which doesn't work

I tried this line in the Dialog thinking that it may work

FileBrowse=Browse to the barcode definition file,BCDeffile,Definition Files|C:\simplebcfiling\JobSettings\imagesettings\*.ini|,open

But it didn't

The complete dialog is here

Dialog>Dialog1
Caption=Setup Simple Barcode Filing
Width=448
Height=441
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Image=C:\simplebcfiling\images\setupone.bmp,-3,0,441,409,msImage1,0
Edit=sampleimage,55,109,337,%samp%
Button=Browse to the folder that contains the images to be processed,55,133,337,25,1
Edit=outputpath,55,165,337,%OP%
Button=Browse to the file storage folder,55,189,337,25,0
ComboBox=outfiletype,54,309,65,PDF%CRLF%TIF
Label=Output File Type,126,313,true
ComboBox=repapp,54,333,65,Replace%CRLF%Append
Label=On existing File,126,335,true
Button=Continue,318,309,75,25,4
Button=Exit,318,333,75,25,2
Label=Copyright© eDocFile Inc. 2004-2008,138,389,true
Edit=montime,54,357,33,%MT%
Label=Check Folder in Seconds,94,361,true
Edit=jobnamebox,163,80,121,%JN%
Label=Job Name,200,64,true
Label=If folders do not exist manually enter them and they will be created,69,216,true
Edit=BCDeffile,55,240,337,%bcdef%
Button=Browse to the barcode definition file,55,265,337,25,0
FileBrowse=Browse to the file storage folder,outputpath,|*.*|,dir
FileBrowse=Browse to the folder that contains the images to be processed,sampleimage,|*.*|,dir
FileBrowse=Browse to the barcode definition file,BCDeffile,Definition Files|C:\simplebcfiling\JobSettings\imagesettings\*.ini|,open
EndDialog>Dialog1

I know it is something simple but I cannot seem to figure it out and there is no example I can find showing it in the help file or in this forum.

Has anyone used it before that could show me where my mistake is?
[/code]

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 12:34 pm

You would need to use ResetDialogAction after setting that variable:

Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings
ResetDialogAction>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Where to put reset dialog action for setting path

Post by kpassaur » Mon Mar 31, 2008 12:46 pm

I tried what you suggested. If I place it before the dialog, since there is no dialog there is none to set, therefore I get an error.

If I place it after the dialog and before the "Show" I get a dialog filled with gibberish.

Where do I need to set it? I want it always to open the same folder, I will be having two files with the same name, one in one folder and one in another, the user needs to pick the correct one.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 12:48 pm

You need to show it first, so that it is initialised:

Show>Dialog1
Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings
ResetDialogAction>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Dialog folder and drop down list

Post by kpassaur » Mon Mar 31, 2008 1:33 pm

Marcus,

That works but it changes the values in the drop down lists to blank and in the drop down places %dial - I cannot read the rest of the line.

The values are correct in the text boxes.

Why is this, they were not touched?

Any ideas

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 2:02 pm

You need:


Show>Dialog1

GetDialoGaction>Dialog1,r
Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings
ResetDialogAction>Dialog1

... and continue ...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

And Continue?

Post by kpassaur » Mon Mar 31, 2008 2:15 pm

What do you mean and Continue?

I have the dialogbox it has two drop down lists in it, If I add the line to set the default folder the values of the drop down list disapear. I could understand it if the item index for them were reset, but that is not the case. The values in the list disapear.

Are you saying that if you use this line to set a default folder you have to add a line to set the value in each drop down list and then caculate the index value for each item in a drop down list.

If you are there is an idea for an enhancement. Setting a default path should be simple.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 2:22 pm

The values in the list do not disappear for me.

I mean continue with your script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Drop down list issue with setting path in dialog

Post by kpassaur » Mon Mar 31, 2008 2:56 pm

Well mine dosn't work any ideas as to why? Here is the script


Let>APP_TITLE=Barcode Filing


/*
File folder needs to be set to the C:\simplebcfiling\JobSettings\imagesettings folder in Dialog1


Step one prompt for a sample image
Ask if this is the path of the scanned images
Ask for an ouput path for images
Step two copy image to a config folder naming it the job name tif
open bcplacement with sample image
save setup as job name ini
*/
GoSub>loadlist
SRT>loadlist
GetFileList>C:\simplebcfiling\JobSettings\*.ini,files
StringReplace>files,C:\simplebcfiling\JobSettings\,,filelist
StringReplace>filelist,;,%CRLF%,filelist
StringReplace>filelist,.ini,,filelist
End>loadlist

Dialog>Dialog2
Caption=Job Manager
Width=311
Height=216
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Image=C:\simplebcfiling\images\profilemanager.bmp,0,0,353,185,msImage1,0
Label=Copyright© eDocFile Inc. 2004-2008,69,160,true
ComboBox=Profilechoicecombo,82,92,145,%filelist%
Button=Open,97,122,57,25,1
Button=Exit,211,122,57,25,2
Button=Delete,154,122,57,25,3
Button=New,40,122,57,25,4
EndDialog>Dialog2



Show>Dialog2,r
Label>Displaydialog2
If>r=1,Openit
If>r=2,finish
If>r=5,RunScan
If>r=3,deleteit
If>r=4,Newjob
GetDialogAction>Dialog2,r
Goto>Displaydialog2

SRT>deleteit
DeleteFile>C:\simplebcfiling\JobSettings\%Dialog2.Profilechoicecombo%.ini
ResetDialogAction>Dialog2
GoSub>loadlist
Let>DIALOG2.PROFILECHOICECOMBO.Items.text=%filelist%
Let>DIALOG2.PROFILECHOICECOMBO.itemindex=0
ResetDialogAction>Dialog2
Let>r=10
Show>Dialog2
End>deleteit

Label>Openit
Let>jname=%Dialog2.Profilechoicecombo%

IfFileExists>C:\simplebcfiling\JobSettings\%jname%.ini
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Sample Image,samp
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Storage Path,OP
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,On Existing File,OEF
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Storage Type,ST
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Monitor Time,MT
ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Definition File,bcdef

Let>JN=jname
//ReadIniFile>C:\simplebcfiling\JobSettings\%jname%.ini,Settings,Job Name,JN

If>%OEF%=Replace
Let>DIALOG1.REPAPP.ITEMINDEX=0
Else
Let>DIALOG1.REPAPP.ITEMINDEX=1
Endif

If>%ST%=PDF
Let>DIALOG1.OUTFILETYPE.ITEMINDEX=0
Else
Let>DIALOG1.OUTFILETYPE.ITEMINDEX=1
Endif
Endif
Goto>displaysetup
Label>Newjob
Let>JN=
Let>samp=
Let>OP=
Let>MT=
Let>bcdef=

Label>displaysetup


Dialog>Dialog1
Caption=Setup Simple Barcode Filing
Width=448
Height=441
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Image=C:\simplebcfiling\images\setupone.bmp,-3,0,441,409,msImage1,0
Edit=sampleimage,55,109,337,%samp%
Button=Browse to the folder that contains the images to be processed,55,133,337,25,1
Edit=outputpath,55,165,337,%OP%
Button=Browse to the file storage folder,55,189,337,25,0
ComboBox=outfiletype,54,309,65,PDF%CRLF%TIF
Label=Output File Type,126,313,true
ComboBox=repapp,54,333,65,Replace%CRLF%Append
Label=On existing File,126,335,true
Button=Continue,318,309,75,25,4
Button=Exit,318,333,75,25,2
Label=Copyright© eDocFile Inc. 2004-2008,138,389,true
Edit=montime,54,357,33,%MT%
Label=Check Folder in Seconds,94,361,true
Edit=jobnamebox,163,80,121,%JN%
Label=Job Name,200,64,true
Label=If folders do not exist manually enter them and they will be created,69,216,true
Edit=BCDeffile,55,240,337,%bcdef%
Button=Browse to the barcode definition file,55,265,337,25,0
FileBrowse=Browse to the file storage folder,outputpath,|*.*|,dir
FileBrowse=Browse to the folder that contains the images to be processed,sampleimage,|*.*|,dir
FileBrowse=Browse to the barcode definition file,BCDeffile,Definition Files|*.ini|,open
EndDialog>Dialog1



Show>Dialog1
Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings
ResetDialogAction>Dialog1
Label>MainLoop
GetDialogAction>Dialog1,result
If>result=2,finish
If>result=4,Continue
Wait>0.1
Goto>MainLoop

Label>Continue

Let>jobname=%Dialog1.jobnamebox%


IfDirExists>%Dialog1.sampleimage%,skipstorage1
Let>RP_WINDOWMODE=0
RunProgram>cmd /c MD "%Dialog1.sampleimage%"
Let>RP_WINDOWMODE=1
Label>skipstorage1

IfDirExists>%Dialog1.outputpath%,skipstorage2
Let>RP_WINDOWMODE=0
RunProgram>cmd /c MD "%Dialog1.outputpath%"
Let>RP_WINDOWMODE=1
Label>skipstorage2

DeleteFile>C:\simplebcfiling\JobSettings\%jobname%.ini
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,[Settings]
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Sample Image=%Dialog1.sampleimage%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,On Existing File=%Dialog1.repapp%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Storage Path=%Dialog1.outputpath%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Storage Type=%Dialog1.outfiletype%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Monitor Time=%Dialog1.montime%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Job Name=%Dialog1.jobnamebox%
WriteLn>C:\simplebcfiling\JobSettings\%jobname%.ini,result,Definition File=%Dialog1.BCDeffile%

IfFileExists>C:\simplebcfiling\JobSettings\setupimage.tif
DeleteFile>C:\simplebcfiling\JobSettings\setupimage.tif
Endif
CopyFile>%Dialog1.sampleimage%,C:\simplebcfiling\JobSettings\setupimage.tif

/*
Run bcplacement and save the file as simplelocation.ini
*/

Label>finish

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 2:59 pm

You've missed out the GeDialogAction after the Show. As per my last post, it should be:

Show>Dialog1
GetDialogAction>Dialog1
Let>Dialog1.BCDeffile.fbinit=C:\simplebcfiling\JobSettings\imagesettings
ResetDialogAction>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Getdialog action

Post by kpassaur » Mon Mar 31, 2008 3:05 pm

Missed that, didn't think I needed it since it was in the loop below

Thanks

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 31, 2008 3:07 pm

You need it there because you need to get the stuff from the dialog before you can put it all back. Without it and just calling ResetDialogAction you will have stuff missing.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts