Hello,
im just starting over with macros and have very little experience.
however the main reason i need macros is to open (numbered) files from within the open dialog of a program so the programm execute and save them (its a multiplexer without batch function).
I dont get it how to automate the open dialog so its opening the next numbered file.
Could you please give me some hints or direct me where this is already discussed?
Thanks,
Matthias
Open files in a programm, one after another
Moderators: Dorian (MJT support), JRL
i got it by myself
maybe it could be done simpler without these mouse moves but it works.
maybe it could be done simpler without these mouse moves but it works.
Code: Select all
//Loop start: NumTimesToLoop = How many files should be executed
Let>NumTimesToLoop=20
Let>Counter=0
// Selector is for file counting
Let>Selector=0
Label>StartOfLoop
// open the Open dialog from within the programm
MouseMove>381,91
Wait>0.18
LClick
//choose first file in folder, enter
WaitWindowOpen>Open
Wait>0.05
MouseMove>50,166
Wait>0.10
LClick
Wait>0.10
// The selector tells which file has to be opend
Press Down * Selector
Wait>0.10
Press Enter
Wait>0.10
//Open dialog closes automaticaly. Press save within the Multiplexer window
MouseMove>137,395
Wait>0.10
LClick
// Loop ende
Add>Counter,1
// as the saved files go into the same folder(and are selectable from the open dialog) selector ads 2
Add>Selector,2
If>Counter=NumTimesToLoop,FinishLoop
Goto>StartOfLoop
Label>FinishLoop
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Standard file open dialogs allow you to type directly into the filename field, and even provide a full path. Thus avoiding the need to "pick" from the explorer. The file box is usually the default field.
So, if the name of the file is already known it can just be sent directly to the open dialog:
WaitWindowOpen>Open
Send>c:\some_dir\some_file.fil
And then just pressing Enter will hit the OK button:
Press Enter
Ok, so that's easier than mouse moves etc. You just need to know the file name up front. In your case it sounds like you want to loop through some files in a folder. For that you can use the GetFileList command to get a list of files matching a given filespec. Use Separate to explode this list to an array. Then loop through it and for each one send the filename direct to the open dialog as above. See GetFileList in the help file for an example of looping through a list of files.
So, if the name of the file is already known it can just be sent directly to the open dialog:
WaitWindowOpen>Open
Send>c:\some_dir\some_file.fil
And then just pressing Enter will hit the OK button:
Press Enter
Ok, so that's easier than mouse moves etc. You just need to know the file name up front. In your case it sounds like you want to loop through some files in a folder. For that you can use the GetFileList command to get a list of files matching a given filespec. Use Separate to explode this list to an array. Then loop through it and for each one send the filename direct to the open dialog as above. See GetFileList in the help file for an example of looping through a list of files.
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?