Problems with "Set Focus" in Windows XP

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Maverick
Newbie
Posts: 1
Joined: Tue Dec 02, 2003 7:23 pm
Contact:

Problems with "Set Focus" in Windows XP

Post by Maverick » Tue Dec 02, 2003 7:35 pm

I have written a macro that works fine in Windows 2000 but not in Windows XP. In windows XP we are getting a targeting error saying the page requested cannot be found.

Let me explain the scripts use. It is to copy text from one page to a target on another.

Here is the code:

SetFocus>Rizzo Ford - Microsoft Internet Explorer
Press CTRL
Send>C
Release CTRL
SetFocus>Review - Microsoft Internet Explorer
Press CTRL
Send>V
Release CTRL
ramindianic: SetFocus>Rizzo Ford - Microsoft Internet Explorer
Press CTRL
Send>C
Release CTRL
SetFocus>Review - Microsoft Internet Explorer
Press CTRL
Send>V
Release CTRL

Please advise on how to fix the Windows XP issue or if you are having any problems.

Sincerely,

David

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 02, 2003 9:17 pm

macro that works fine in Windows 2000
I don't know how the sample code you provided could have worked unless you already have text selected and cursors in source and destination positions.

SetFocus> just makes a window the current active window. You probably want to include CTRL-A before you do CTRL-C. You need to highlight a selection to be copied, or else CTRL-C does nothing.

It also looks like you are trying to paste into an explorer web page which you won't be able to do unless you are filling in some type of form.

And remember that you must move the cursor to the position where you want the pasting done.

It's also a good habit to include "*" in the Window name.

Try the following to copy a full page. Have no idea where you will be pasting. You will have to add that.

Comments are in bold blue
Changes are in bold red
SetFocus>Rizzo Ford - Microsoft Internet Explorer*
//Select All
Press CTRL
Send>A
Release CTRL

Press CTRL
Send>C
Release CTRL
SetFocus>Review - Microsoft Internet Explorer*
//Press Tab*n or MouseMoveRel> to get to correct pasting position
Press CTRL
Send>V
Release CTRL
//What is "ramindianic:"?
ramindianic: SetFocus>Rizzo Ford - Microsoft Internet Explorer*
//Select All
Press CTRL
Send>A
Release CTRL

Press CTRL
Send>C
Release CTRL
SetFocus>Review - Microsoft Internet Explorer*
//Press Tab*n or MouseMoveRel> to get to correct pasting position
Press CTRL
Send>V
Release CTRL
You could also do this vs. CRTL-A to select a specific area:
Press Tab*n or MouseMoveRel> and select with arrows to get specific text to copy.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Dec 04, 2003 12:37 am

Hi Maverick,

Firstly, please make sure there're no trailing spaces in your script.
Secondly, you may try to add waitready>1 after setfocus>. For example:

SetFocus>Rizzo Ford - Microsoft Internet Explorer
Waitready>1
Press CTRL
Send>C
Release CTRL

Lately I discover setfocus> requires relatively more time in all my Macro Scheduler scripts written for Office 2003.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts