PRESS CTRL

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
sylvain245
Newbie
Posts: 2
Joined: Mon Jan 17, 2011 5:49 pm

PRESS CTRL

Post by sylvain245 » Mon Jan 17, 2011 6:03 pm

Hello,

I use a PRESS/RELEASE Ctrl in loop to open source, select all, copy, close...

The first time, all things work good, but after the first past of the loop, the source open, but not select or copy, any idea why ?

I tried to add some wait time or no, but dont change anything

Code: Select all

Let>k=1
Repeat>k
//Show page web source
Press CTRL
wait>0.1
Send>u
wait>0.1
Release CTRL
wait>3

//select all
Press CTRL
wait>0.1
Send>a
wait>0.1
Release CTRL
wait>3

//copie
Press CTRL
wait>0.1
Send>c
wait>0.1
Release CTRL
wait>3

//close
Press CTRL
wait>0.1
Send>w
wait>0.1
Release CTRL
wait>3


GetClipBoard>codeSource
Wait>3
Let>k=k+1

Until>k,10
Thx

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 17, 2011 11:20 pm

Your script works splendidly for me. Using Firefox, I sat on one web page and watched the text highlight three times. then I moved to another tab after the source window closed the third time and it continued working as I moved from tab to tab. After ten passes the source for the last website was in the clipboard. I don't see any problem.

sylvain245
Newbie
Posts: 2
Joined: Mon Jan 17, 2011 5:49 pm

Post by sylvain245 » Tue Jan 18, 2011 8:35 am

Hello, I use Firefox too, but for me, either on firefox or ie, the text highlight only 1 time. Dont know why.

So i soluce my problem with mouse move, lclick/rightclick, resize windows... but its longer...

Im on Windows Seven 64 bit, using Firefox 3.6.13

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Mon Jan 24, 2011 9:09 pm

use VK_KEYS it is much better for key presses
try this
this is link for wich code to use for what key you want to press
http://www.mjtnet.com/vkcodes.htm

Code: Select all

Let>VK_control=17
Let>ExtendedKey=1
Let>KeyUp=2

Press ctrl
LibFunc>user32.dll,keybd_event,r,VK_control,0,ExtendedKey,0
Wait>10
Release ctrl
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_control,0,FLAGS,0

if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Tue Jan 25, 2011 7:52 pm

idiot wrote:use VK_KEYS it is much better for key presses
I might want to do just that... but can you tell me why it is better to use those two Win API calls instead of just using Send> ?

Is it faster? More reliable? And if so, can anyone explain why? I assume the Send> command must be using these same calls underneath?

And I take it, the following line actually presses (Sends) a key?

Code: Select all

LibFunc>user32.dll,keybd_event,r,VK_control,0,ExtendedKey,0
So then what are these two lines doing?

Code: Select all

Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_control,0,FLAGS,0
Thanks for any info...

Marcus, any comments?
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Jan 25, 2011 9:42 pm

Do a forum search for "keybd_event". Mostly what you'll find is that it is useful if you need to hold a key press for an extended period of time. I don't think it is "better" than Send> or Press [keyname] under ordinary circumstances.

idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

Post by idiot » Wed Jan 26, 2011 1:52 am

in some cases like reading lines from a file and sending them to a window i would use send command but in most cases especially in gaming scripts if you want to hold down a vk_keys is more reliable and less detectable also and it actually performs differently then "send> f2*40" to hold down a key this actually just sends the command for pressing and releasing the key 40 times
while vk presses the key down and waits for next code to key up so is a more realistic key press but for sending a whole line the send key normally works fine in some instances in games it still dosent send the line corectly with the help of some of the people here i learned how to pipe code so i can still use vk_keys with that
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

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