Hello -this is my first post and also I am new to macro scheduler and scripts in general. I have this macro that worked great in windows xp but now does not work in 7.What I am trying to do is take information from excel and paste it into notepad in a specific folder. Any help would be greatly appreciated.
//Specify the path of the Excel file here
Let>filename=P:\Sigmanest Import Files\SIGMANEST TASK SHEET-BM.xlsx
//Start Excel
ExecuteFile>filename
WaitWindowOpen>Microsoft Excel -*
Wait>.5
//I'm going to paste the data into Notepad
Run>Notepad.exe
WaitWindowOpen>Untitled - Notepad
let>r=2
Repeat>r
//here is where it gets info and copies
DDERequest>Excel,filename,R%r%C4,field_1,10
StringReplace>field_1,CRLF,,field_1
Let>WF_TYPE=1
SetFocus>Notepad*
SendText>%field_1%
DDERequest>Excel,filename,R%r%C1,field_1,10
StringReplace>field_1,CRLF,,field_1
SetFocus>Notepad*
SendText>%field_1%,
DDERequest>Excel,filename,R%r%C2,field_1,10
StringReplace>field_1,CRLF,,field_1
SetFocus>Notepad*
SendText>%field_1%,1
Press Enter
let>r=r+1
Wait>.15
Until>r=10
// here are the commands to save the files and close the apps
Let>filename=sigmanest task sheet.txt
let>path=P:\Sigmanest Import Files\
Press ALT
Send>fa
Release ALT
WaitWindowOpen>Save As
//delete file if it exists
IfFileExists>filename,fileexists
Goto>savefile
Label>fileexists
DeleteFile>filename
Label>savefile
SetFocus>Save As
Send>filename
Press Enter
Wait>.8
SetFocus>Notepad*
Press ALT
Send>fx
Release ALT
Wait>.8
SetFocus>excel*
Press ALT
Send>fx
Release ALT
Let>CF_OVERWRITE=1
CopyFile>P:\Sigmanest Import Files\sigmanest task sheet.txt,P:\Sigmanest Import Files\sigmanest task sheet.bom
Script not working correctly with windows 7
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
- Which bit doesn't work?
- Any reason for not using XL functions instead of DDE or are you using an old version of Macro Scheduler?
- Are the paths still the same?
- Obvious question - is Excel installed on this new PC
- Do you have the required permissions to write to the specified folders (the - new OS may have different security settings etc).
- Don't like some of your Waits (e.g. your Wait>.8 after pressing enter on the save as box is unreliable and would be better to use a WaitWindowClosed here to wait for the SaveAs box to disappear). It's possible that the new OS is slower or faster and your waits are insufficient.
- Any reason for not using XL functions instead of DDE or are you using an old version of Macro Scheduler?
- Are the paths still the same?
- Obvious question - is Excel installed on this new PC
- Do you have the required permissions to write to the specified folders (the - new OS may have different security settings etc).
- Don't like some of your Waits (e.g. your Wait>.8 after pressing enter on the save as box is unreliable and would be better to use a WaitWindowClosed here to wait for the SaveAs box to disappear). It's possible that the new OS is slower or faster and your waits are insufficient.
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?
The part that does not work is the saving out of the files. The macro does grab the info from excel and paste it into notepad correctly but when it goes to save the files it stops. It is funny and could be the wait commands because it has worked a time or two but more than not is stops at the save. I am using Macro scheduler version 11. I do have excel and admin permissions.
Thanks again
Thanks again