Here's an interesting one:
In my FTP script here: http://www.mjtnet.com/forum/viewtopic.php?p=26385#26385
There is a small section that writes the path chosen by a Macro Scheduler Browse (open) command to my ini file.
When next starting the path is loaded from the ini file into the browse edit area.
There are different sections in the ini file for each FTP site and the idea was that the application would start up in the same directory that you left off - different for each FTP site, as stored in the ini file.
However - although the path is loaded into the edit area and all the correct variables seem to be set, when you hit "Browse" it simply browses to teh last location you were at, ignoring the path that is in the browse dialog.
Hmm...
So I tried a last ditch attempt to get it working by copying the path to clipboard and waiting for the window "Open" to open and then pasting the path into the Open dialog. Unfortunately even that won;t work as "open" window is not recognised.
So can anyone think of a way round this?
I also found another issue which I will post separately.
Cheers everyone,
Phil.
Restoring a path for Browse Button
Moderators: JRL, Dorian (MJT support)
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Restoring a path for Browse Button
Phil Pendlebury - Linktree
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Thanks JRL that I think, is pretty much it I think.
No need to add you to credits as you are already there.

No need to add you to credits as you are already there.

Phil Pendlebury - Linktree
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
OK. I just realised that is exactly what I had originally.
If you have time, give this a try:
Make a small dialog with a browse button.
Then do something like this.
FileBrowse=Browse,msEdit6,,open,yourpathvariable,thisfile.jpg
With a way of changing the "yourpathvariable" when loading the dialog.
On my system there is nothing entered into the file browser edit box unless I put the variable as the default value of the edit box too. AND when the "Open" window is opened it always browses back to the last path browsed not the path stored in the variable. But the filename thisfile.jpg has been entered.
Does that make sense?
If you have time, give this a try:
Make a small dialog with a browse button.
Then do something like this.
FileBrowse=Browse,msEdit6,,open,yourpathvariable,thisfile.jpg
With a way of changing the "yourpathvariable" when loading the dialog.
On my system there is nothing entered into the file browser edit box unless I put the variable as the default value of the edit box too. AND when the "Open" window is opened it always browses back to the last path browsed not the path stored in the variable. But the filename thisfile.jpg has been entered.
Does that make sense?
Phil Pendlebury - Linktree
Hi Phil,
I think what you're looking for is found in Dialog FileBrowse Help.
Hope this helps.
I think what you're looking for is found in Dialog FileBrowse Help.
Here's a sample demonstrating. remark out the Let>Dialog1.msEdit1.fbinit=%item_1% line and FileBrowse will always default to the c:\ root. Leave the line unremarked and FileBrowse will default to the last folder visited. You must pick the "Ok" button after browsing to reset all the variables.initialdir and filename allow the browse box to default to a directory and/or filename. To set initialdir and/or filename at run time set DialogName.TextObjectName.fbinit=initialdir,filename
Hope this helps.
Code: Select all
Dialog>Dialog1
Caption=Browse Sample
Width=442
Height=140
Top=165
Left=48
Edit=msEdit1,38,41,267,
Button=Browse,315,39,75,25,0
Button=Ok,132,80,75,25,3
FileBrowse=Browse,msEdit1,,open,c:\
EndDialog>Dialog1
Show>Dialog1
Label>Loop
GetDialogAction>Dialog1,res1
If>res1=2
Exit>0
EndIf
If>Res1=3
GoSub>Process
EndIf
goto>Loop
SRT>Process
MDL>Dialog1.msEdit1
//I'm sure Bob can write a RegEx to replace most of the following block.
////////////////////////////////////////////////////////////////////////
Separate>Dialog1.msEdit1,\,item
Let>kk=1
Repeat>kk
Add>kk,1
Let>value=item_%kk%
Concat>item_1,\%value%
Until>%kk%={(%item_count%-1)}
//This is the line that resets the file browse default.
Let>Dialog1.msEdit1.fbinit=%item_1%
/////////////////////////////////////////////////////////////////////////
ResetDialogAction>Dialog1
END>Process
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Hi JRL,
Using your simple example I can demonstrate my problem easily.
Take this script:
Notice that whatever value you set path to (in the first line) is ignored, it always opens to the last place you have browsed to.
If you actually put the path in there instead of "%path%" for example:
Then it seems to work.
Please try it and see.
Howvere, adding:
Seems to work so I will give that a go.

Using your simple example I can demonstrate my problem easily.
Take this script:
Code: Select all
Let>path=d:/
Dialog>Dialog1
Caption=Browse Sample
Width=442
Height=140
Top=165
Left=48
Edit=msEdit1,38,41,267,
Button=Browse,315,39,75,25,0
Button=Ok,132,80,75,25,3
FileBrowse=Browse,msEdit1,,open,%path%
EndDialog>Dialog1
Show>Dialog1
Label>Loop
GetDialogAction>Dialog1,res1
If>res1=2
Exit>0
EndIf
If>Res1=3
GoSub>Process
EndIf
goto>Loop
If you actually put the path in there instead of "%path%" for example:
Code: Select all
FileBrowse=Browse,msEdit1,,open,d:/
Please try it and see.
Howvere, adding:
Code: Select all
SRT>Process
Let>Dialog1.msEdit1.fbinit=%path%
rda>Dialog1
END>Process

Phil Pendlebury - Linktree
- Phil Pendlebury
- Automation Wizard
- Posts: 543
- Joined: Tue Jan 16, 2007 9:00 am
- Contact:
Ok fixed it with this:
/////////////////////////////////////////
IF>fromsendto=False
Let>FTPDialog.msEdit6.fbinit=%def_file%
rda>FTPDialog
ENDIF
/////////////////////////////////////////
See the FTP script.
Thanks again. Still not sure why the initial idea didn't work before adding fbinit (see above).

/////////////////////////////////////////
IF>fromsendto=False
Let>FTPDialog.msEdit6.fbinit=%def_file%
rda>FTPDialog
ENDIF
/////////////////////////////////////////
See the FTP script.
Thanks again. Still not sure why the initial idea didn't work before adding fbinit (see above).

Phil Pendlebury - Linktree