GetClipBoard does not work

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
machinogodzilla
Newbie
Posts: 17
Joined: Sun Jul 30, 2006 11:32 pm

GetClipBoard does not work

Post by machinogodzilla » Mon Aug 28, 2006 3:07 pm

Hi! I was trying to retrieve some text from the website. So I wrote:

MouseMove>100,505
LClick
Press Shift

MouseMove>215,505
LClick
Release Shift

Press CTRL
Send>c
Release CTRL

GetClipBoard>Something
MessageModal>%Something%
This macro works perfectly. So I put it at the end of another macro (which works perfectly too) and a bug appeared.

It all goes fine until "Press CTRL" command or so and then Macro Sched crushes taking all my processor resources.

What is wrong?

And BTW what is "WaitClipBoard" for? When I put it into macro nothing happens but the message box appears with a text WaitClipBoard in it.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Aug 28, 2006 3:10 pm

Which version of Macro Scheduler do you have?

WaitClipBoard waits until the clipboard is available. Something else may have it locked. Most often it will appear to do nothing. But it will also prevent msched from trying to access the clipboard while something else is writing to it.

You might also want to try a delay before the GetClipBoard:

Press CTRL
Send>v
Release CTRL
Wait>1
WaitClipBoard
GetClipBoard>blabla
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
machinogodzilla
Newbie
Posts: 17
Joined: Sun Jul 30, 2006 11:32 pm

Post by machinogodzilla » Mon Aug 28, 2006 3:25 pm

I have not seen such rapid replies anywhere else on forums :shock:

Thx! :D

Back to the subject. I am using MSched 8.0.3.

I have just copied a bit of the code "Wait>1; WaitClipBoard" to my macro. What happend now was that the message box appeared saying... "Wait>1; WaitClipBoard" which must have stayed in the clipboard from the last copying. The only good thing was that MSched did not crush this time.

Before I asked I had put Wait>0.5 after every single line in my macro and there had been no difference.

I think I can also say that nothing is writing to my clipboard during the execution of the macro because what I put there before remains the same.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Aug 28, 2006 3:31 pm

Can you post your full script? I can't understand why you'd get a message box containing the script commands! Sounds like you have some erroneous code there.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Aug 28, 2006 3:56 pm

Careful kids, do not try running machonogodzilla's original script with the Macro Scheduler window open, it will max the CPU and be very hard to exit :lol:

It does work fine run from quick launch with a notepad window.

User avatar
machinogodzilla
Newbie
Posts: 17
Joined: Sun Jul 30, 2006 11:32 pm

Post by machinogodzilla » Mon Aug 28, 2006 4:02 pm

I got some idea from our conversation.

The script command appeared there because it remained in the clipboard from copying from your message. It seemed then the macro got stuck while pressing "Ctrl+c".

The other macro is massive but I have recalled that I was using "c" variable pretty much. I have changed it to "w" and... it all works now!

My variable was interfering with "Send>c" then or the other way round :wink: . I don't know. I don't use percent marks all the time, just when necessary. Maybe this. But it is the same way in the help file.

But as I said before. My macro was working tip-top with both "c" variable and "w" variable.

Anyway the problem is resolved, though a bit cryptic. Thanx for help! :)

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Aug 28, 2006 4:07 pm

To avoid confusing literals with variables you can use:

Let>VAR_EXPLICIT=1

then Send>c would send "c" and Send>%c% would send contents of variable c. With default behaviour (VAR_EXPLICIT=0) then if a variable called c exists it will use that instead of the literalt.

Either way a good tip is to use variable names that can't be confused. c is a bad name for a variable. More descriptive and less ambiguous variable names can be used like:

strClipBoardContents

or:

intLoopCounter

etc.

Just a few ideas.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
machinogodzilla
Newbie
Posts: 17
Joined: Sun Jul 30, 2006 11:32 pm

Post by machinogodzilla » Mon Aug 28, 2006 4:24 pm

Thanks mtettmar. Now it is all clear. :)

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