![]() Next up: How to make it hold multiple strings! Now we can save the script and also run it by double clicking the file as this will copy and paste just fine but lets wait. Then we will also end this rutine with a return command return Send, ^v (^ = ctrl) + vĪfter the paste is done, all we need to do is restore the old clipboard from our variable “old_clip”. So now the clipboard holds our string and we can send the windows keyboard shortcut for pasting. Then we can set the stored string from our variable as the content of the clipboard so we can paste the string from the variable “clip_one” back. if (clip_one = "") if the variable is emptyīut if the variable holds data, the if statment will be false and script will skip the next line (the line below the if satament) and let the script proceed to the lines after, here we will put the content of our variable “clip_one” back on the clipboard, so we can use it with the normal windows pasting keys (ctrl+v).īut before we do all that, we frist store the existing content of the normal clipboard in the variable “old_clip” so we can restore the clipboard content back agian after we have pasted our string. Okay now if the variable is empty the IF statment will be true and the line right under it will be run, so here we will put a “return” command to put the script backin to a waiting stat (waiting for a new hotkey press). Because if our variable is empty we don’t need to paste anything and then there is no need to run anymore lines from this rutine and the return will help us do that. Then for this we will again make a hotkey that we can use to paste our string back, how about using shift+1 for this? +1:: this is a hotkey = shift+1Īfter that the frist thing we check is the content of our variable “clip_one”, for this we will use an IF condition statment that will tell us if something is true or false. Does that make sense to you? Ready to write a rutine to paste back the copied string we just got stored in our variable? Okay I hope that was not way over your head! If so, I’d like to know in the comments please, and i’ll do my best to help you with your copy and paste needs. Most! if not all, things must have an end, so to end this hotkey rutine we will use the “return” command return clip_one := ClipboardĪfter that we then restore the old content back on the clipboard from the variable that we store at the start of this hotkey rutine Clipboard := old_clip Okay now the clipboard holds the string that’s selected in the active window so lets store that copy in a new variable, we can call it “clip_one”. ClipWait, 2 wait for the empty clipboard to hold data So with this line we can wait for the keys we send, to copy the active selection in to the clipboard. So now we will wait for the clipboard to hold data, this will be easy, if the clipboard is empty, and remember we did empty the clipboard above. ^ is short for using to the active window. Here the first two lines are just info to the user so we use the as it makes the lines comments, and the script will not use them. In AutoHotkey the is the character for comments by defult so everything after the does nothing. Lets get to the lines of code as this is a tutorial on how to make a script that can hold multiple copied strings and paste them back. Right-click the file and choose Edit Script.Įach script is a plain text file containing commands to be executed by AutoHotkey.exe.Type a name for the file, ensuring that it ends in.(Alternatively, select New -> Text Document.) In the menu that appears, select New -> AutoHotkey Script.Right-click an empty spot on your desktop or in a folder of your choice. ![]() Now if you have AutoHotkey installed you can skip step one in this list. ![]() A text editor like Notepad or something like SciTE4AutoHotkeyĪnd 16 lines of plain text from this how-to.Before we start, all you need are 2 things:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |