Sign in to follow this  
Followers 0
was2

Send ("{A DOWN}") with variable?

8 posts in this topic

Hey !

I was thinking about doing an automated "send" command, with a chosen key, but i cant get it to work with a variable. I've already tried the code of another thread, but that doesnt work either. Do you know how i can get it to work?

Share this post


Link to post
Share on other sites



show us the code you used and what's the program you're trying to interact with?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

show us the code you used and what's the program you're trying to interact with?

I'm not trying to interact with a specific program, i want to make a copy-paste program, with an input line where you can type the words you want to send and specify a hotkey. The code i use is the following:

$var = GuiCtrlRead($Input1)

Send("{" & $var & "down}")
sleep(20)
Send("{" & $var & "up}")

That one doesnt work, neither with single letters and i dont get why... i've also tried those:

send($var&{down})

send($var & "{down}")

but they didnt work either.

Share this post


Link to post
Share on other sites

Try:

$var = GuiCtrlRead($Input1)
Send("{" & $var & " down}")
sleep(20)
Send("{" & $var & " up}")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

Try:

$var = GuiCtrlRead($Input1)
Send("{" & $var & " down}")
sleep(20)
Send("{" & $var & " up}")

Thats exactly the code i posted, why should it work now?

1 person likes this

Share this post


Link to post
Share on other sites

This example might give you a few ideas.

Global $var = ""
HotKeySet("^!i", "_InputFunc"); Press Ctrl+Alt+i keys to input data in InputBox.(Highlighted text is put in InputBox.)
HotKeySet("^!s", "_SendFunc") ; Press Ctrl+Alt+s keys to insert data at blinking cursor position, or;
;                                             Highlight text to be replace then press Ctrl+Alt+s keys.
HotKeySet("{ESC}", "_Terminate"); Press Esc key to exit loop (end script)

While Sleep(20)
WEnd

; Press Ctrl+Alt+i keys
Func _InputFunc()
    Send("^c")                  ; Copy highlighted text to clipboard.
    $var = InputBox("Input Data", "Enter data to be send", ClipGet())
EndFunc   ;==>_InputFunc

; Press Ctrl+Alt+s keys
Func _SendFunc()
    Send($var)
EndFunc   ;==>_SendFunc

; Press Esc key
Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

Share this post


Link to post
Share on other sites

Did you notice the additional space?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

From helpfile:

[optional] Changes how "keys" is processed:
  flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses.
  flag = 1, keys are sent raw.

So, this does the trick ;)

$var = GuiCtrlRead($Input1)

Send("{" & $var & "down}", 1)
sleep(20)
Send("{" & $var & "up}", 1)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0