Dialog help for a noob!
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
Dialog help for a noob!
Hi to all..
I understand all the scripting but I still just don't get dialogs at all...
If someone could type up an example in the following form and comment the heck out of it as if you were teaching a 5yr old that would be grate because apparently my brain can't grasp dialogs at all...
What I want to be able to do is:
Dialog appears with 1 input box for the user to type in data which i would like to be stored to a variable for later use. And another one to have a button to click on being a file browser to locate a file and its path to be stored in a variable for later use as well..
After that I want to be able to click a run button that executes the rest of my script... I can't for the life of me figure this out...
thanks in advance to all that help...
-kitt
I understand all the scripting but I still just don't get dialogs at all...
If someone could type up an example in the following form and comment the heck out of it as if you were teaching a 5yr old that would be grate because apparently my brain can't grasp dialogs at all...
What I want to be able to do is:
Dialog appears with 1 input box for the user to type in data which i would like to be stored to a variable for later use. And another one to have a button to click on being a file browser to locate a file and its path to be stored in a variable for later use as well..
After that I want to be able to click a run button that executes the rest of my script... I can't for the life of me figure this out...
thanks in advance to all that help...
-kitt
Does this help?
The user inputted data will automatically be stored in a variable named "Dialog1.msedit1", And the user selected file name will be stored in a variable named "Dialog1.msEdit2". Step through this is in the editor and watch the watch list to see all that's happening.
The user inputted data will automatically be stored in a variable named "Dialog1.msedit1", And the user selected file name will be stored in a variable named "Dialog1.msEdit2". Step through this is in the editor and watch the watch list to see all that's happening.
Code: Select all
Dialog>Dialog1
//The Caption is the name of the dialog window
Caption=Sample
//The size of the dialog window
Width=445
Height=191
Top=156
Left=28
//Dialog object definitions
//Labels let tyou communicate your desires for usage of the dialog.
//The first text following the equal is the text that will appear
//in the dialog. The numbers represent the xa nd y location of the
//label within the dialog.
Label=Type your data,32,16
Label=Select the file,32,64
//An edit object lets a user input a line of data
//msEdit is the name of the first object. the three numbers represent
//its x and y location within the dialog and the length of the object.
//An edit object's height is fixed.
Edit=msEdit1,32,32,305,
Edit=msEdit2,32,80,305,
//A button object allows a user to choose options within the dialog.
//Browse is the name of the first object. The numbers represent
//its x and y location within the dialog, the length of the object, the
//height of the object and the last number is the result of the user pressing
//the button. For the Browse button that result can be zero. For other buttons
//it should be a number unique to that button. The number "2" is reserved for
//"Cancel". The button press result number is passed to the Show> result which
//in this case is the variable "res1"
Button=Browse,344,80,75,25,0
Button=Ok,344,120,75,25,3
//Filebrowse... read help for dialog to learn about filebrowse.
FileBrowse=Browse,msEdit2,All Files|*.*,open
EndDialog>Dialog1
//Show displays a dialog and the variable at the end captures the result of a button press.
Show>Dialog1,res1
//The rest of the script
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
thank you but still a little confused...
First let me say thanks for the help it's really helped me understand the dialog scripting.. however I still cant figure out
where is the data being stored that the user inputs?
I would like to store it to a variable to call on it later in the script how does that work... if its in your example I guess I just don't get it but I don't think it is...
If anyone could explain that to me it would be grate...
And once again thanks for the help already given...
-kitt
where is the data being stored that the user inputs?
I would like to store it to a variable to call on it later in the script how does that work... if its in your example I guess I just don't get it but I don't think it is...
If anyone could explain that to me it would be grate...
And once again thanks for the help already given...
-kitt
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
As Dick explained, it's already in a variable. The variable for the first edit field (msEdit1 is called Dialog1.msEdit1). Hopefully the following version of Dick's script will make it blindingly obvious (run it, enter something in the first edit box and hit OK and notice the message box appear, then look at the last line of the script)
Code: Select all
Dialog>Dialog1
//The Caption is the name of the dialog window
Caption=Sample
//The size of the dialog window
Width=445
Height=191
Top=156
Left=28
//Dialog object definitions
//Labels let tyou communicate your desires for usage of the dialog.
//The first text following the equal is the text that will appear
//in the dialog. The numbers represent the xa nd y location of the
//label within the dialog.
Label=Type your data,32,16
Label=Select the file,32,64
//An edit object lets a user input a line of data
//msEdit is the name of the first object. the three numbers represent
//its x and y location within the dialog and the length of the object.
//An edit object's height is fixed.
Edit=msEdit1,32,32,305,
Edit=msEdit2,32,80,305,
//A button object allows a user to choose options within the dialog.
//Browse is the name of the first object. The numbers represent
//its x and y location within the dialog, the length of the object, the
//height of the object and the last number is the result of the user pressing
//the button. For the Browse button that result can be zero. For other buttons
//it should be a number unique to that button. The number "2" is reserved for
//"Cancel". The button press result number is passed to the Show> result which
//in this case is the variable "res1"
Button=Browse,344,80,75,25,0
Button=Ok,344,120,75,25,3
//Filebrowse... read help for dialog to learn about filebrowse.
FileBrowse=Browse,msEdit2,All Files|*.*,open
EndDialog>Dialog1
//Show displays a dialog and the variable at the end captures the result of a button press.
Show>Dialog1,res1
//The rest of the script
MessageModal>User entered: %Dialog1.msEdit1%
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?
kitt050383 wrote:where is the data being stored that the user inputs?
I would like to store it to a variable to call on it later in the script how does that work...
Dick wrote:The user inputted data will automatically be stored in a variable named "Dialog1.msedit1", And the user selected file name will be stored in a variable named "Dialog1.msEdit2". Step through this is in the editor and watch the watch list to see all that's happening.
the name of the variable is Dialog1.msedit1. No further storage is required. Just use that variable.
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
like i said noob help...
thanks for all the help guys I finally understand and now I do realize yes it was blindingly obvious to the point where I'm embarrassed lol....
thank you so so so very much for all the help...
-kitt
thank you so so so very much for all the help...
-kitt
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
some more questions lol....
First let me say thanks JRL cuz now I can finally do some dialogs which I have..
How do you make it so if someone checks a check box on your dialog later when it opens the program your automating it checks it off in that program...
thanks for all the help...
-kitt
-edit-
Originally I was asking about how to make a button fill in an input box with information but I figured that part out myself took me a while but I did it on my own lol... but help with the check boxes is most appreciated....
here's the button info press I figured out lol... I'm so proud of myself lol...
How do you make it so if someone checks a check box on your dialog later when it opens the program your automating it checks it off in that program...
thanks for all the help...
-kitt
-edit-
Originally I was asking about how to make a button fill in an input box with information but I figured that part out myself took me a while but I did it on my own lol... but help with the check boxes is most appreciated....
here's the button info press I figured out lol... I'm so proud of myself lol...
Code: Select all
Dialog>Dialog1
Caption=Dialog1
Width=222
Height=87
Top=204
Left=379
Edit=msEdit1,0,16,121,
Button=Silent,128,16,75,25,5
EndDialog>Dialog1
show>Dialog1
label>ActionLoop
GetDialogAction>Dialog1,r
if>r=5,Silent
Goto>ActionLoop
Label>exit
SRT>Silent
Let>Dialog1.msEdit1=C:\wadder\silent.mp3
ResetDialogAction>Dialog1
END>Silent
Good job.*applause*
In order to keep settings from one session to the next of any app. The setting must be saved to a file. Probably the easiest way to do that in Macro Scheduler is by using the two INI functions. ReadINIFile> and EditINIFile. Look these up in help to see details of how they work.
Here's your last script modified with INI handling. You should be able to step through this in the editor and figure out whats going on.
In order to keep settings from one session to the next of any app. The setting must be saved to a file. Probably the easiest way to do that in Macro Scheduler is by using the two INI functions. ReadINIFile> and EditINIFile. Look these up in help to see details of how they work.
Here's your last script modified with INI handling. You should be able to step through this in the editor and figure out whats going on.
Code: Select all
Let>INIFile=%Temp_Dir%testing.ini
IfFileExists>INIFile
ReadIniFile>INIFile,Settings,checkbox1,checkboxvalue
Else
WriteLn>INIFile,wres,[Settings]
WriteLn>INIFile,wres,checkbox1=True
Let>checkboxvalue=True
EndIf
Dialog>Dialog1
Caption=Dialog1
Width=226
Height=120
Top=264
Left=20
Edit=msEdit1,0,16,121,
Button=Silent,128,16,75,25,5
CheckBox=msCheckBox1,How am I set,13,64,97,%checkboxvalue%
EndDialog>Dialog1
show>Dialog1
label>ActionLoop
GetDialogAction>Dialog1,res1
If>res1=2,exit
if>res1=5,Silent
Goto>ActionLoop
Label>exit
EditIniFile>INIFile,Settings,checkbox1,DIALOG1.MSCHECKBOX1
SRT>Silent
Let>Dialog1.msEdit1=C:\wadder\silent.mp3
ResetDialogAction>Dialog1
END>Silent
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
thanks.. again.. but still confused....
I wanted to do this:
check a box in my dialog
when user clicks run
it stores that the box is checked into variable i guess in this case ini file
then when it gets to the point where the script needs to check the box it does..
your example from above will help me with my next script..
thanks again...
-kitt
check a box in my dialog
when user clicks run
it stores that the box is checked into variable i guess in this case ini file
then when it gets to the point where the script needs to check the box it does..
your example from above will help me with my next script..
thanks again...
-kitt
You don't need to save anything to a variable, Macro Scheduler is doing that for you. The value of the checkbox in the example above is automatically saved to the variable "DIALOG1.MSCHECKBOX1"
Later in the script you simply call "DIALOG1.MSCHECKBOX1" as you would any other variable. The value returned by a checkbox can only be "True" or "False". Therefore, the value of the variable "DIALOG1.MSCHECKBOX1" will be either "True" or "False".
When you get to the point in your script where you want to set another application's checkbox based upon the checkbox selection in your dialog. Your best bet is to read the value of "DIALOG1.MSCHECKBOX1" then use the SetCheckbox> function.
Later in the script you simply call "DIALOG1.MSCHECKBOX1" as you would any other variable. The value returned by a checkbox can only be "True" or "False". Therefore, the value of the variable "DIALOG1.MSCHECKBOX1" will be either "True" or "False".
Sorry I missed this part earlier.then when it gets to the point where the script needs to check the box it does.
When you get to the point in your script where you want to set another application's checkbox based upon the checkbox selection in your dialog. Your best bet is to read the value of "DIALOG1.MSCHECKBOX1" then use the SetCheckbox> function.
Help wrote: SetCheckBox>window_title,object_caption,TRUE|FALSE
SetCheckBox is used to check or uncheck a given checkbox or radio button. Specify the window title of the window containing the check box/radio button, and the object's caption. The caption of a check box or radio button is the text appearing next to it. The caption must be specified accurately with attention paid to case. Where a letter is underlined indicating a shortcut key, enter the '&' character before it.
-
- Newbie
- Posts: 6
- Joined: Tue Mar 03, 2009 6:27 am
thanks again...
through much screwing around with trial and error and after reading your comment before on how it automatically gets stored into a variable which i don't know why i have such a hard time understanding that lol... but I figured it all out along with your help so thank you so much JRL!!!
-kitt
-kitt