Clipboard problem

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bjorn82dk
Newbie
Posts: 13
Joined: Sat Jun 23, 2012 10:41 am
Location: Copgenhagen, Denmark

Clipboard problem

Post by bjorn82dk » Sat Jun 23, 2012 10:56 am

Hi all,
I have a big problem du I don't think its the Macro wich fails. I have a macro wich copys text from one screen and paste it onto another screen (in a MS Access db). It works fine, not fails for the first hour. After that I have to reboot the machine. I tried slowing down the script to ensure its not a timing isue. I also use the "WaitClipBoard"

and the

Code: Select all

Label>wait_for_data1
Wait>1.0
GetClipBoard>clipdata
If>clipdata=dummy99
  Goto>wait_for_data1
Endif


But I guess if I'm going to find one who have had this problem it might be here on the site. So anyone ever heard about this or have a fix?

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

Post by jpuziano » Mon Jun 25, 2012 5:05 pm

Hi bjorn82dk,

Replace the code you posted with the following lines instead, test (for hours) to see if the problem goes away and post your results to let us know:

Code: Select all

Label>wait_for_data1
Wait>1.0
GetClipBoard>clipdata
If>clipdata=dummy99,wait_for_data1
If the problem goes away, you have just proven that using a GoTo> statement inside an If/EndIf statement is not a good idea. I have always avoided that... because depending on how this is implemented, it may be eating up a little bit of memory each time as execution will rarely fall to the EndIf line (as it probably spends most of its time waiting) so the If/EndIf statement almost never gets to "unwind" so-to-speak.

This scenario definitely exists with GoSub and is the reason why you should never escape a subroutine using a Goto> as you'll chew up memory... do it enough times and you'll run out/crash.

So... even though the above uses the older form of the If Statement, if it is free of this problem... its one example where the older form is superior.

Enjoy and take care
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 - :-)

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