| View previous topic :: View next topic |
| Author |
Message |
mAdDoG
Joined: 29 Dec 2004 Posts: 62
|
Posted: Mon Mar 14, 2005 12:23 am Post subject: Cursor-highlighted variable |
|
|
Hi guys, me again-
How can I turn "cursor-highlighted text" into a variable? _________________ -buttons, buttons,...
I like to push all the buttons!!! |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 12:26 am Post subject: |
|
|
Here's a part of my script.
| Code: | ;Save and clear clipboard
ClipSaved := ClipboardAll
Clipboard =
;Cut highlight to clipboard
Send, ^x
;If nothing is highlighted, select all and cut
If Clipboard is Space
{
;Select all and cut to clipboard
Send, ^a^x
}
;get rid of all carriage returns (`r).
StringReplace, ClipboardString, Clipboard, `r`n, `n, All
;restore the original clipboard and free memory
Clipboard := ClipSaved
ClipSaved =
|
_________________ Ciao
toralf  |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4016 Location: Pittsburgh
|
Posted: Mon Mar 14, 2005 7:11 pm Post subject: |
|
|
Is this what you meant? | Code: | !z:: ; Alt-z hotkey
ClipSaved := ClipboardAll ; Save original clipboard
Send ^c ; highlighted text to clipboard
VarName := ClipBoard ; Name of the new variable
%VarName%= your_value ; Since you didn't know the variable name
; at writing the script, you have to use %...%
Clipboard := ClipSaved ; Restore original clipboard
ClipSaved = ; Free memory
return | Select some text, press Alt-z and you have a new variable with the selection as its name. Your script can only access it with indirection (%VarName%), because you did not know the name of the variable at the time of writing the script. |
|
| Back to top |
|
 |
|