AutoHotkey Community

It is currently May 27th, 2012, 12:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: December 17th, 2009, 3:43 am 
Offline

Joined: March 26th, 2009, 4:41 am
Posts: 15
I'm pasting a variable (using SendInput) into the field of a program, and sometimes the variable is long and the field takes awhile before all the text is accepted.


Is there a way AHK can figure out when it's done?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 3:58 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
look at ControlGetTxt..

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 2:34 pm 
Offline

Joined: March 26th, 2009, 4:41 am
Posts: 15
Would I use ControlGetText to compare the text of the control to the variable I'm pasting and when they both are the same, I know the variable was finished being pasted?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 2:39 pm 
ClipBoard := MyVar
SendInput, ^v


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 2:52 pm 
Offline

Joined: March 26th, 2009, 4:41 am
Posts: 15
That's what I ended up doing. I found that pasting the clipboard, i.e. {Control down}v{Control up} is much faster than SendInput, %MyVar%.

Still curious how I could use ControlGetText to figure out when the variable had been completely pasted....


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 3:13 pm 
Just an idea
Code:
; Works when My Computer is open.
F1::
var = My Computer
Loop,
{
   ControlGetText, conTxt, Edit1, My Computer
   if (var = conTxt)
      {
      Msgbox, % "The control contains the desired text."
      Break
      }
   Else
      {
      Msgbox, % "The control contains " conTxt "`nIts not the desire text."
      Break
   }
}

Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 3:23 pm 
hardcider09 wrote:
Would I use ControlGetText to compare the text of the control to the variable I'm pasting and when they both are the same, I know the variable was finished being pasted?

If the target control responds to ControlGetText, then why bother with either SendInput or the clipboard? Just use ControlSetText or Control, EditPaste, either of which are as fast as pasting the clipboard (and neither uses the clipboard). Check them out in the help file.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 7:40 pm 
Offline

Joined: March 26th, 2009, 4:41 am
Posts: 15
habdrom wrote:
If the target control responds to ControlGetText, then why bother with either SendInput or the clipboard? Just use ControlSetText or Control, EditPaste, either of which are as fast as pasting the clipboard (and neither uses the clipboard). Check them out in the help file.



I love it! I have only written a few scripts and haven't worked with "controls" yet, but now seems like the right time to start! Thanks!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], iDrug, Leef_me, Ohnitiel, rjgatito, XstatyK, Yahoo [Bot] and 18 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