[CLOSED] how do I pass dialog variables in a macro to
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
[CLOSED] how do I pass dialog variables in a macro to
MacroOne
Dialog>Dialog1
Caption=Notice
Width=445
Height=250
Top=104
Left=16
Edit=FileName,80,72,121,FilSeqCustomers
Button=OK,356,80,75,25,0
EndDialog>Dialog1
Show>dialog1,r
IfFileExists>msEdit1,existe,nexistepas
label>existe
MessageModal>"File exists"
DeleteFile>msEdit1
goto>fin
Label>nexistepas
MessageModal>"File not found"
Label>Fin
I want to use this macro below in BATCH like
MacroTwo
Macro>MacroOne.scp /FileName=NewFile
MacroTwo fails. How can I pass the value to the defined dialog variable?
Or other solution?
Thank you
Dialog>Dialog1
Caption=Notice
Width=445
Height=250
Top=104
Left=16
Edit=FileName,80,72,121,FilSeqCustomers
Button=OK,356,80,75,25,0
EndDialog>Dialog1
Show>dialog1,r
IfFileExists>msEdit1,existe,nexistepas
label>existe
MessageModal>"File exists"
DeleteFile>msEdit1
goto>fin
Label>nexistepas
MessageModal>"File not found"
Label>Fin
I want to use this macro below in BATCH like
MacroTwo
Macro>MacroOne.scp /FileName=NewFile
MacroTwo fails. How can I pass the value to the defined dialog variable?
Or other solution?
Thank you
Last edited by Patrick Le Derff on Fri Sep 07, 2007 7:55 am, edited 1 time in total.
MacroScheduler 9 1 04e
Evaluating the product
Evaluating the product
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You mean:
Macro>%SCRIPT_DIR%\MacroOne.scp /FilSeqCustomers=NewFile
If MacroOne.scp is in a different folder to the calling macro replaces %SCRIPT_DIR% with the path.
Macro>%SCRIPT_DIR%\MacroOne.scp /FilSeqCustomers=NewFile
If MacroOne.scp is in a different folder to the calling macro replaces %SCRIPT_DIR% with the path.
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?
There are multiple syntax errors
try this and compare the code with yours to see the changes
Macro>[drive]:\[path]\MacroOne.scp /FileName=NewFile
try this and compare the code with yours to see the changes
Macro>[drive]:\[path]\MacroOne.scp /FileName=NewFile
Code: Select all
//Assigned checks to see if text string "filename"
//has a value and is therefore a variable
Assigned>filename,result
//If filename is a variable put its value in
//the edit box to look at it
If>result=TRUE
Dialog>Dialog1
Caption=Notice
Width=445
Height=250
Top=104
Left=16
Edit=msEdit1,80,72,121,%filename%
Button=OK,356,80,75,25,3
EndDialog>Dialog1
Show>dialog1,r
//if the value of filename is a valid existing file
//delete it, if not, report that filename does not exist
IfFileExists>dialog1.msEdit1,existe,nexistepas
label>existe
MessageModal>File %filename% exists
DeleteFile>%dialog1.msEdit1%
goto>Fin
Label>nexistepas
MessageModal>File %filename% not found
Label>Fin
EndIf
Else
MessageModal>No File specified
EndIf
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
both macros are in the same directory but in different file.
With the first macro (MacroOne it is a sample) I want to delete a file if exists. I run the macro and i fill the field and it works.
In the second macro I want to run the first macro without displaying the dialog but to pass the parameters directly
Excuse for my english but I am connected from France
Do You understand what I wannt to do?
rgds
With the first macro (MacroOne it is a sample) I want to delete a file if exists. I run the macro and i fill the field and it works.
In the second macro I want to run the first macro without displaying the dialog but to pass the parameters directly
Excuse for my english but I am connected from France
Do You understand what I wannt to do?
rgds
MacroScheduler 9 1 04e
Evaluating the product
Evaluating the product
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
So I think you want:
Code: Select all
//Assigned checks to see if text string "filename"
//has a value and is therefore a variable
Assigned>filename,result
//Do we have a filename or not
If>result=TRUE
Let>thefile=filename
Else
//no filename passed, so display a dialog to request it
Dialog>Dialog1
Caption=Notice
Width=316
Height=152
Top=226
Left=155
Edit=msEdit1,24,24,177,
Button=OK,108,72,75,25,3
Button=Browse,208,24,75,25,0
FileBrowse=Browse,msEdit1
EndDialog>Dialog1
Show>dialog1,r
Let>thefile=dialog1.msEdit1
Endif
//if the value of filename is a valid existing file
//delete it, if not, report that filename does not exist
IfFileExists>thefile,existe,nexistepas
label>existe
MessageModal>File %thefile% exists
DeleteFile>%thefile%
goto>Fin
Label>nexistepas
MessageModal>File %thefile% not found
Label>Fin
EndIf
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?
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just hit Post Reply, write your message and hit Submit. You don't need to enter anything in the Subject. Just like you have just done.
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?
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
What earlier message? Did we miss something?
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?
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The new variable is filename. Use this code:
Call it with:
Macro>%SCRIPT_DIR%\MacroOne.scp /filename=c:\bla\somefile.fil
Note the very first line of the script above checks to see if filename is assigned. If not it shows the dialog. If it is it ignores the dialog.
Code: Select all
//Assigned checks to see if text string "filename"
//has a value and is therefore a variable
Assigned>filename,result
//Do we have a filename or not
If>result=TRUE
Let>thefile=filename
Else
//no filename passed, so display a dialog to request it
Dialog>Dialog1
Caption=Notice
Width=316
Height=152
Top=226
Left=155
Edit=msEdit1,24,24,177,
Button=OK,108,72,75,25,3
Button=Browse,208,24,75,25,0
FileBrowse=Browse,msEdit1
EndDialog>Dialog1
Show>dialog1,r
Let>thefile=dialog1.msEdit1
Endif
//if the value of filename is a valid existing file
//delete it, if not, report that filename does not exist
IfFileExists>thefile,existe,nexistepas
label>existe
MessageModal>File %thefile% exists
DeleteFile>%thefile%
goto>Fin
Label>nexistepas
MessageModal>File %thefile% not found
Label>Fin
EndIf
Macro>%SCRIPT_DIR%\MacroOne.scp /filename=c:\bla\somefile.fil
Note the very first line of the script above checks to see if filename is assigned. If not it shows the dialog. If it is it ignores the dialog.
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?
-
- Newbie
- Posts: 7
- Joined: Thu Sep 06, 2007 10:00 am