AutoHotkey Community

It is currently May 26th, 2012, 7:05 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: May 19th, 2008, 10:37 pm 
Offline

Joined: October 28th, 2006, 11:36 pm
Posts: 191
Hi all,

I'm saving then clearing the clipboard. Sometimes my script runs too fast, I guess, and doesn't wait for the clipboard to clear.

How can I pause to wait for the clear clipboard at the end of this script?

Code:
ClipSaved:=ClipboardAll         

 ClipBoard=

The code that follows this clipboard code is:
Code:
Send,{Home}+{End}       ;Select line
   Send,^x                 ;copy selected text to clipboard
   ClipWait,2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 10:42 pm 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
My failure way:

Code:
Check:
if clipboard !=  ;Does not equal nothing
  goto check


There's probably a better way to do this :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Check goto check
PostPosted: May 19th, 2008, 10:50 pm 
Offline

Joined: October 28th, 2006, 11:36 pm
Posts: 191
Nice -- it seems to work well. Is there a failsafe to make sure I don't wind up in an endless loop?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 19th, 2008, 11:36 pm 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
Not tested
Code:
Loop 50{
if clipboard !=  ;Does not equal nothing
  Continue
else
  Break
}


Or..

Code:
Loop 5{
if clipboard !=  ;Does not equal nothing
  {
    sleep 10
    Continue
  }
else
  Break
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2008, 12:25 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
Code:
oclip := clipboardall
clipboard := ""
Sendplay {end}+{home}^x
clipwait, 1
msgbox % clipboard
clipboard := oclip

seems to work for me.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 20th, 2008, 2:39 pm 
Offline

Joined: October 28th, 2006, 11:36 pm
Posts: 191
Sometimes it does the right operation and sometimes it just dumps the old clipboard on the ^v. Is there any other way to force it?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: dmg, Google Feedfetcher, kkkddd1 and 63 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group