FileBrowse Object in New Version 7.3.10

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
jwm0vmh
Newbie
Posts: 9
Joined: Sun Jul 06, 2003 3:44 pm

FileBrowse Object in New Version 7.3.10

Post by jwm0vmh » Tue Feb 15, 2005 1:47 pm

Do you have an example of how to use the FileBrowse object in the new MS version 7.3.10?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 15, 2005 2:01 pm

Suppose you had a button named msButton1 and an Edit named msEdit1 and you wanted the file browser to be invoked when you hit msButton1 and put the result in msEdit1 - just add the following line at the end of a dialog object:

FileBrowse=msButton1,msEdit1
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 6:57 am

I have 3 issues re Browse Button.

1. I am struggling with setting fbinit value in a Browse Button. Could use a clear example. (The Help section for Dialogs needs to catch up with the features. Need examples showing all options). Would also be good to add a Browse Button to the Objects Pick List. It took the longest time to figure out how to add the button manually.

2. The filter does not seem to work for me. *.txt\Text Files, shows up fine in the File Type box, but all file types still show up in the listing of files. Expected to only see files with .txt extensions.

3. Using &Browse for the button name but ALT-B does not activate the button, Other buttons on the form do work with the accelerator key. It's not the letter that is the problem, I swapped different letters with same result.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 18, 2005 7:05 am

An example:

Dialog>Dialog1
Caption=Dialog1
Top=112
Width=282
Left=16
Height=99
Edit=txtBrowse,24,24,121,
Button=&Browse,152,24,75,25,0
FileBrowse=&Browse,txtBrowse,Text Files|*.txt
EndDialog>Dialog1

Show>Dialog1,r
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 7:44 am

Thanks for example, but 2 of 3 questions were answered.

1 I am struggling with setting fbinit value in a Browse Button. Need an example. Here is my most current one, after about a dozen variations:

Code: Select all

FileBrowse=&Browse,Selection,*.txt\Text Files,open,%TrialMessage.Selection.fbinit%,Hunt36.txt
2. The filter does not seem to work for me. FIXED-Thanks!
Your reply "Text Files|*.txt" is different from Help section which shows "*.txt|Text Files|*.*|All Files". Good news is that the format you just provided seems to be working. Help section needs to be updated.

3. ALT-B does not activate the button
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 18, 2005 7:56 am

Alt-B works for me.

fbinit is for setting the initial dir/filename at runtime. It therefore works in conjunction with ResetDialogAction with non-modal dialogs:

Let>Dialog1.txtBrowse.fbinit=d:\
ResetDialogAction>Dialog1

To set the initial directory for a modal dialog set the FileBrowse object accordingly:

FileBrowse=&Browse,txtBrowse,Text Files|*.txt,open,f:\

Will update help file with correct mask. Apologies for that error.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 4:19 pm

Almost there.......

ALT-B is working now, but I don't think I changed anything. Hmmmm, must have been a type somewhere. Item closed, thanks.
----------------------------------------------------

Default Directory for modal Dialog DOES work if it is hard coded.
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,C:\Sesame\Data,hunt36.db

But it does NOT work if I use a variable. The example you provided has "f:\" hardcoded.
That is not my problem. Sorry, I was not more clear in earlier question.

---------------------------------------------
None of of the following examples work.
And I know that some are questionable in syntax, but I am trying all options, searching for the solution.
There is no need to comment on any of them, just providing examples of my struggles.

Let>DatabaseDir=C:\Sesame\Data
and then within the Dialog I do:
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,%DatabaseDir%,hunt36.db

Let>TrialMessage.Selection.fbinit=C:\Sesame\Data
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,%TrialMessage.Selection.fbinit%,hunt36.db

Let>TrialMessage.Selection.fbinit=C:\Sesame\Data
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,,hunt36.db

Let>TrialMessage.Selection.fbinit=C:\Sesame\Data
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,%fbinit%,hunt36.db

Let>fbinit=C:\Sesame\Data
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,%fbinit%,hunt36.db

Let>fbinit=%DatabaseDir%
FileBrowse=&Browse,Selection,SesameApplications|*.db,open,%fbinit%,hunt36.db

---------------------
All of the other Dialog Objects seem to accept variables with no problem. What am I doing wrong?

=================
Also, I am not clear about the difference between modal and non-modal Dialogs.
There appears to be no difference within the Dialog structure.
Is the use of dynamic changes with ResetDialog> the difference that makes it non-modal?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 18, 2005 4:22 pm

The difference between Modal and Non-modal is that since non-modal dialogs are always open you change it's properties and characteristics within the action loop with ResetDialogAction. fbinit is a property of the filebrowse text object. As I said:

Let>Dialog1.txtBrowse.fbinit=d:\
ResetDialogAction>Dialog1
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 4:48 pm

Your last response confirms my understanding about the differences. Part of my confusion has been the use of Modal.
From Wiki explanation of Modal Windows:
modal window is a child window created by a parent application, usually a dialog box, which has to be closed before the user can continue to operate the application.
All of Macro Schedulers Dialogs must be closed before the user can continue.
Am I incorrect in my understanding that "both" of the Macro Scheduler Dialogs would be Modal under that definition?
Or could they both be considered non-modal since they only halt the continuation in the Macro Scheduler script. It is possible for the user to ignore the Dialog and perform other activities.

I am not trying to be difficult, just trying to understand the use of the terminology of Modal/Non-Modal as used by Macro Scheduler.

----------------------------------
I guess this discussion could be a separate topic of its own. I need to refocus back on my current problem:

In any event, as mentioned in my questions, I am still trying to use a variable for the default directory in a non-modal dialog. Is this not possible?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 18, 2005 6:50 pm

Bob Hansen wrote:All of Macro Schedulers Dialogs must be closed before the user can continue.
That's not true at all. If you open a dialog non-modally then the script continues immediately and if the script developer allows it the user can "continue". To prove it:

Show>Dialog1
Message>Hello
Wait>5
Close>Dialog1

Note the dialog appears followed by a message box - the dialog is still active - and after 5 seconds the dialog will close.

It just so happens that most people use a non-modal dialog along with a loop which continually polls the state of the dialog breaking out of the loop and continuing with the rest of the script only when the dialog is closed by the user. It therefore appears modal to the user but is in fact non-modal as the script can continue processing while it is open.

This is in fact precisely how Windows applications work at a low level - they have a main non-modal form and an event loop.

A modal dialog prevents program execution continuing until it is closed and therefore the above cannot be done with a modal dialog.

I feel that WIKI's definition is incorrect in that it is not the user that can't or can continue but program execution that defines whether or not a form is modal. A modal window halts program execution until it is closed. A non-modal form does not. The definition regarding user's "continuing" is somewhat nonsensical and in any case depends on how the program works.

It would seem from your post that non-modal dialogs and the amazing things you can do with them in Macro Scheduler have passed you unawares. Check out the calculator sample script to see what using a non-modal dialog with an action loop can achieve.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 7:25 pm

It just so happens that most people use a non-modal dialog along with a loop which continually polls the state of the dialog breaking out of the loop and continuing with the rest of the script only when the dialog is closed by the user. It therefore appears modal to the user but is in fact non-modal as the script can continue processing while it is open.
That's me! :oops: Didn't even realize that I was forcing it to stay open.
It just became part of the normal Dialog design for me. :oops: :oops:

Thanks for the explanations. :D

Now.....back to my final problem....
Is it possible to use a variable in a non-modal dialog box to set the default directory for a Browse Button?
Have I been trying to do the impossible?

==============================
If you do an upgrade without doing a full install you do not get some of the newer script samples.
Here is a link to the Calulator script that was mentioned above. Not doing the full install on an upgrade is frequently normal because you do not want to overwrite some existing information.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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