| View previous topic :: View next topic |
| Author |
Message |
hardcider09
Joined: 26 Mar 2009 Posts: 15
|
Posted: Thu Dec 17, 2009 2:43 am Post subject: Waiting until long string has FINISHED pasting |
|
|
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? |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
|
| Back to top |
|
 |
hardcider09
Joined: 26 Mar 2009 Posts: 15
|
Posted: Thu Dec 17, 2009 1:34 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
SlowMotion Guest
|
Posted: Thu Dec 17, 2009 1:39 pm Post subject: |
|
|
ClipBoard := MyVar
SendInput, ^v |
|
| Back to top |
|
 |
hardcider09
Joined: 26 Mar 2009 Posts: 15
|
Posted: Thu Dec 17, 2009 1:52 pm Post subject: |
|
|
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.... |
|
| Back to top |
|
 |
nulljector Guest
|
Posted: Thu Dec 17, 2009 2:13 pm Post subject: |
|
|
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 |
|
|
| Back to top |
|
 |
habdrom Guest
|
Posted: Thu Dec 17, 2009 2:23 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
hardcider09
Joined: 26 Mar 2009 Posts: 15
|
Posted: Thu Dec 17, 2009 6:40 pm Post subject: |
|
|
| 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! |
|
| Back to top |
|
 |
|