Script will not Recognise Window
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
Script will not Recognise Window
I am trying to write a script to log into my bank account and export the transactions to a CSV file. This is how the Banks Site Works.
When you have selected the range of transactions that you want to export, you select an output format and then press ENTER. The site then pops up a "File Download" Dialog/Window and lets you enter a Filename. You press enter and the File is saved.
I recorded the script using WebRecorder and it all looked good, producing the following extract of code :-
------------------------------------------------------------------------------------
WaitWindowOpen>File Download
SetFocus>File Download
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename="C:\MickeyTheChips"
Wait>1
sSend>s
WaitWindowOpen>Save As
SetFocus>Save As
"Send>filename
Press Enter
WaitWindowClosed>Save As
-------------------------------------------------------------------------------------
The problem is that when I run it through the debugger, it gets stuck at "WaitWindowOpen>File Download" and never goes any further.
Thanks for any ideas ?
When you have selected the range of transactions that you want to export, you select an output format and then press ENTER. The site then pops up a "File Download" Dialog/Window and lets you enter a Filename. You press enter and the File is saved.
I recorded the script using WebRecorder and it all looked good, producing the following extract of code :-
------------------------------------------------------------------------------------
WaitWindowOpen>File Download
SetFocus>File Download
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename="C:\MickeyTheChips"
Wait>1
sSend>s
WaitWindowOpen>Save As
SetFocus>Save As
"Send>filename
Press Enter
WaitWindowClosed>Save As
-------------------------------------------------------------------------------------
The problem is that when I run it through the debugger, it gets stuck at "WaitWindowOpen>File Download" and never goes any further.
Thanks for any ideas ?
Add an asterisk (*) after File Download.
Like this:
Like this:
Code: Select all
WaitWindowOpen>File Download*
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
Thanks very much for your reply, but unfortunately that did not work.
It almost seems that because the "File Download" screen does not appear visibly on the screen when the script is run as opposed to being recorded, the the Script cannot see it.
I even used GetActiveWindow just before the WaitWindowOpen and it came back with No Active Window. Below is an image of the window exactly as it appears when recording :-
Once again thanks for your reply.
It almost seems that because the "File Download" screen does not appear visibly on the screen when the script is run as opposed to being recorded, the the Script cannot see it.
I even used GetActiveWindow just before the WaitWindowOpen and it came back with No Active Window. Below is an image of the window exactly as it appears when recording :-
Once again thanks for your reply.
First glance.. couple of typo's in your code:
Remove s and " from your SEND>
Code: Select all
sSend>s
"Send>filename
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
Fantastic, that worked, but now when I get down to the Send>s, it actually sends the s to the debugger, hence the reason it now says sSend>s. It then hangs on the WWO>Save* waiting for the "Save Filename As" Window to appear.
//WaitWindowOpen>File Download*
WWO>File*
SetFocus>File*
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename=download.file
Wait>1
sSend>s
WWO>Save*
SetFocus>Save*
Send>filename
Press Enter
WWC>Save*
WWO>%filename%*
WWC>%filename%*
//WaitWindowOpen>File Download*
WWO>File*
SetFocus>File*
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename=download.file
Wait>1
sSend>s
WWO>Save*
SetFocus>Save*
Send>filename
Press Enter
WWC>Save*
WWO>%filename%*
WWC>%filename%*
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
So if you are getting past the File Download piece... it's going to be the SEND>S
you need to get the 's' out of the sSend>
Can you post your actual script and not the debug? The sSend> would appear when running in Debug/Trace, but your actual code cannot contain that s.
I think if you remove the s, the SEND>s will work and your script will continue to the Save As window..
you need to get the 's' out of the sSend>
Can you post your actual script and not the debug? The sSend> would appear when running in Debug/Trace, but your actual code cannot contain that s.
I think if you remove the s, the SEND>s will work and your script will continue to the Save As window..
-
- Newbie
- Posts: 8
- Joined: Wed Jun 04, 2008 4:05 am
This is the actual code :-
Thanks for continued help.
Code: Select all
// Generated by MacroScript WebRecorder 2.03
// Recorded on Wednesday, June 4, 2008, at 03:26 PM
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1
IE_Create>0,IE[8]
IE_Navigate>%IE[8]%,www.netbank.com.au,r
IE_Wait>%IE[8]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"LOGINForm"}
Let>FieldName={"USER_LOGON_NAME"}
Let>FieldValue={""}
IE_FormFill>%IE[8]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={"LOGINForm"}
Let>FieldName={"PASSWORD"}
Let>FieldValue={""}
IE_FormFill>%IE[8]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={"LOGINForm"}
Let>TagValue={"login"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
IE_Wait>%IE[8]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"LOGINForm"}
Let>TagValue={"export transactions"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,A,TEXT,str:TagValue,r
IE_Wait>%IE[8]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={"SearchForm"}
Let>FieldName={"ACCOUNT_MOVEMENT_CRITERIA_PO"}
Let>FieldValue={"Mortgage Variable"}
IE_FormFill>%IE[8]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={"SearchForm"}
Let>TagValue={"statemachineEventName"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
IE_Wait>%IE[8]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"METHOD_OF_EXPORT"}
Let>FieldValue={"CSV"}
IE_FormFill>%IE[8]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"statemachineEventName"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
IE_Wait>%IE[8]%,r
Wait>delay
//WaitWindowOpen>File Download*
WWO>File*
SetFocus>File*
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename=download.file
Wait>1
Send>s
WWO>Save*
SetFocus>Save*
Send>filename
Press Enter
WWC>Save*
WWO>%filename%*
WWC>%filename%*
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"https://www3.netbank.commbank.com.au/netbank/images/button_exit.gif"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,IMG,HREF,str:TagValue,r
IE_Wait>%IE[8]%,r
Wait>delay
IE_Wait>%IE[8]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"https://www3.netbank.commbank.com.au/netbank/images/but_close.gif"}
IE_ClickTag>%IE[8]%,str:FrameName,str:FormName,IMG,HREF,str:TagValue,r
Label>end_script
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Replace the Send>s with:
Press ALT
Send>s
Release ALT
s is the shortcut key for the Send button, so it needs to be sent with the ALT key.
Press ALT
Send>s
Release ALT
s is the shortcut key for the Send button, so it needs to be sent with the ALT key.
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: 8
- Joined: Wed Jun 04, 2008 4:05 am
No luck I'm afraid, putting that in opened the Search Drop down in the actual Debugger Window. It thought I wanted to do an ALT-S in the Debugger Window. Code Below :-
I think this software just doesn't cater for this type of Window that opens in Websites. Thanks for all your help. Much appreciated, but I won't waste your time any further.
Code: Select all
IE_Wait>%IE[8]%,r
Wait>delay
//WaitWindowOpen>File Download*
WWO>File*
SetFocus>File*
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename=download.file
Wait>1
Press ALT
Send>s
Release ALT
WWO>Save*
SetFocus>Save*
Send>filename
Press Enter
WWC>Save*
WWO>%filename%*
WWC>%filename%*
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
That's because the debugger is the active window. But if you have Refocus Windows checked in the debug menu and the script had previously focused a different window it should remember that and refocus that window before issuing the ALT-S. However, it can be difficult to debug actions like this that depend on focus, for hopefully obvious reasons. That's why for these sections of code I'd use breakpoints and run to breakpoint, rather step each line.jeffreymen wrote:No luck I'm afraid, putting that in opened the Search Drop down in the actual Debugger Window. It thought I wanted to do an ALT-S in the Debugger Window. Code Below :-
I'm sorry you think that. In fact I have no trouble automating windows like this and in fact Macro Scheduler has, over the last 11 years, been used to automate almost every type of windows imaginable.I think this software just doesn't cater for this type of Window that opens in Websites. Thanks for all your help. Much appreciated, but I won't waste your time any further.
I would debug your script but I can't do that fully because it requires a log in. However, I started a file download from a different website (our own actually) and then ran the pertinent section of code. The following code worked well for me:
Code: Select all
//WaitWindowOpen>File Download*
WWO>File Download*
SetFocus>File Download*
//FILE DOWNLOAD - YOU MAY NEED TO MODIFY THIS PART
//MODIFY FILE PATH AND NAME HERE:
Let>filename=download.file
Wait>1
Press ALT
Send>s
Release ALT
WWO>Save As
SetFocus>Save As
Send>filename
Press Enter
WWC>Save As
WWO>%filename%*
WWC>%filename%*
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: 8
- Joined: Wed Jun 04, 2008 4:05 am
Thanks for your reply. I must say I am extremely impressed at the level of support you offer.
I did have refocus Windows checked and I made sure in recording that the other window did have focus. I do understand about the difficulty of running Focus based Scripts in a debugger.
I am very impressed with the way the product makes things quite simple and am disappointed that I have not been able to get this to work.
I think the problem is that the Save As Dialog appears directly after the Download File Dialog, a problem I am having with another piece of scripting software (iMacros) we are evaluating for our company.
Once again thanks for your help in this matter.
I did have refocus Windows checked and I made sure in recording that the other window did have focus. I do understand about the difficulty of running Focus based Scripts in a debugger.
I am very impressed with the way the product makes things quite simple and am disappointed that I have not been able to get this to work.
I think the problem is that the Save As Dialog appears directly after the Download File Dialog, a problem I am having with another piece of scripting software (iMacros) we are evaluating for our company.
Once again thanks for your help in this matter.