Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

assigning a text string to a keystroke (combination)


  • Please log in to reply

#16
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,018 posts
  • MVP
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <[email="myemail@nowhere.com"]myemail@nowhere.com[/email]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#Hotstring EndChars .

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.


#k::
msgbox HOTKEYS= Mwr - Yargh - Nohelp - PtoP - Meatproduct - Hjtwrong - Nopm - Notstaff - Sfc - Atf - 3days - Smode - Devmngr - Evntvwr - hjtatt - homenet - evrst - dbanit - joinstaff - fixpath - cdgone - bootrebuild - sysrestore - Stupid - TheLine - rimshot - pwd - utubecopy - EML

#IfWinActive ahk_class IEFrame

::editt::[color=red]Edit: 

::endcolor::[/color]

::mwr::
(
Please read the [url=http://www.geekstogo.com/forum/Malware-Spyware-Cleaning-Guide-t2852.html][b]Malware/Spyware cleaning guide here[/b][/url] follow the instructions at the top....

That will give you several steps that will help you clean up 70 percent of all problems by yourself. If at the end of the process you are still having difficulty (and you may not be) then post an OTL log in [B][url=http://www.geekstogo.com/forum/Malware_Removal_HiJackThis_Logs_Go_Here-f37.html]THE MALWARE FORUM[/url][/B] forum. 
[color=red][i](Posting OTL logs or ANY other logs requested in the malware/spyware cleaning guide in any other forum other than the malware forum is forbidden. If you post any of these logs in any other forum, it will be removed and it will take you longer to get help, so please make sure you only post logs in the malware forum)[/i][/color]

If you are still having problems after getting a clean bill of health from the malware expert, please return to [B]this[/B] thread.
)

this is the first few lines of the AHK script that i use currently (very simple, just a text replacer basically)...i'll break it down for you

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <[email="myemail@nowhere.com"]myemail@nowhere.com[/email]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#Hotstring EndChars .

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
this bit is the default stuff that came in the default AHK script template...it does something but i've never bothered to figure it out. except for the part that says "#Hotstring EndChars ." this part tells AHK not to process a hotstring unless it's followed by a period. so i can type editt without it processing my editt script (see below for that part of the script) but if i put a period after it, it will process it

#k::
msgbox HOTKEYS= Mwr - Yargh - Nohelp - PtoP - Meatproduct - Hjtwrong - Nopm - Notstaff - Sfc - Atf - 3days - Smode - Devmngr - Evntvwr - hjtatt - homenet - evrst - dbanit - joinstaff - fixpath - cdgone - bootrebuild - sysrestore - Stupid - TheLine - rimshot - pwd - utubecopy - EML
this is a command that will pop up a message box when i press winkey + k that lists all of the hotkeys that i have defined (sometimes i forget what i called them)

#IfWinActive ahk_class IEFrame
this line makes sure that my hotkeys ONLY occur when IE is open (i didn't want it replacing text in emails or whatever)


::editt::[color=red]Edit: 

::endcolor::[/color]

::mwr::
(
Please read the [url=http://www.geekstogo.com/forum/Malware-Spyware-Cleaning-Guide-t2852.html][b]Malware/Spyware cleaning guide here[/b][/url] follow the instructions at the top....

That will give you several steps that will help you clean up 70 percent of all problems by yourself. If at the end of the process you are still having difficulty (and you may not be) then post an OTL log in [B][url=http://www.geekstogo.com/forum/Malware_Removal_HiJackThis_Logs_Go_Here-f37.html]THE MALWARE FORUM[/url][/B] forum. 
[color=red][i](Posting OTL logs or ANY other logs requested in the malware/spyware cleaning guide in any other forum other than the malware forum is forbidden. If you post any of these logs in any other forum, it will be removed and it will take you longer to get help, so please make sure you only post logs in the malware forum)[/i][/color]

If you are still having problems after getting a clean bill of health from the malware expert, please return to [B]this[/B] thread.
)
these are actual hotkeys

the ::word:: bit is what assigns the hotstring to your script action (in this case it's a text replacer. so every time i type one of my hotstrings like mwr, or editt, or endcolor, or whatever else i have, it replaces the hotstring with the block of text in the script). basically anything between one ::word:: and the next ::word:: will constitute the script (again, here i'm only doing text replacement, you can get MUCH more complex with this thing. you can even script mouse movements)

you'll see that some of my scripts have a parenthesis around them, i had to put those in so that the script in question would process the URL codes correctly within the script. not sure why, i just know i had to do it otherwise the script wouldn't process completely.


so basically, if all you're doing is text replacement, you'd do exactly the same thing as this.

if you wanted it to type your email address every time you typed "mymail" you would make a script like this:

::mymail::
youremailaddress@yourdomain.com
then any time you type mymail it would replace it.

if you wanted it to do your mail, your boss's mail, and your mom's mail it would look like this

::mymail::
youremailaddress@yourdomain.com

::bossmail::
[email="bossemailaddress@yourdomain.com"]bossemailaddress@yourdomain.com[/email]

::mommail::
[email="momemailaddress@yourdomain.com"]momemailaddress@yourdomain.com[/email]


so with this one, you'd type mymail to do your mail, bossmail for your boss's mail and, mommail for your mom's mail

and basically you'd just continue on from there. you can have an unlimited amount of things in there, as long as you remember what they all do.
  • 0

Advertisements


#17
Basty

Basty

    Member

  • Topic Starter
  • Member
  • PipPip
  • 56 posts
I'm afraid that I "can't see the trees for the wood" in what you have kindly offered above. So please indulge me and let me suggest what I have done with success :
""C:\Program Files\Autohotkey\autohotkey.exe" "C:\Data\Batch_Files\Autohotkey\emailadres.ahk"
in a batch file that has been double clicked, lodges one AHK icon in the systray, and correctly enables the hotkey I specified for it, to type out my email address.
If I add the following to the batch file : "C:\Program Files\Autohotkey\autohotkey.exe" "C:\Data\Batch_Files\Autohotkey\landline.AHK",
then after double clicking on the batch file, TWO icons lodge in the systray, but depressing the hotkeys causes my email addres and my phone number to be typed out, respectively.
So far so good.
I want to specify more hotkeys for other strings, but I do NOT want more systray icons, so by way of testing ther system, I tried to combine the two instructions [UNsuccessfully] as follows :
"C:\Program Files\Autohotkey\autohotkey.exe" "C:\Data\Batch_Files\Autohotkey\emailadres.ahk, landline.AHK".
Now there is only one systray icon, but NEITHER hotkey now works.

Can you suggest how I can keep the functionality for both hotkeys, but limit the number of systray icons to just one ?

Edited by Basty, 20 October 2010 - 09:55 AM.

  • 0

#18
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,018 posts
  • MVP
no no no.....you put all of your hotstrings in one ahk file. one after another....then just set the one ahk file to run at startup (or via a batch if you want)....basically just put the .ahk file in the startup folder and it will run when the computer starts
  • 0

#19
Basty

Basty

    Member

  • Topic Starter
  • Member
  • PipPip
  • 56 posts
Your reply seems to focus on how to trigger the running of AHK. What I have asked help with, is how to construct a batchfile script THAT WILL WORK, involving only two hotkeys/strings [and only ONE systray icon]. Once I have a working exmple for two strings, I think I will be able to extrapolate to whatever I want/need. I have given you a successful batchfile for ONE hotkey/string, to show you the kind of thing I am trying to achieve for multiple hotkeys. Hope you can help - there has been NO response from AutoHotKey.com.
  • 0

#20
Basty

Basty

    Member

  • Topic Starter
  • Member
  • PipPip
  • 56 posts
Just after I sent the post above, I realised the problem lay NOT in the batchfile, but in the AHK file. I have managed to set up all my strings and hotkeys in the one AHK, and so have only one AHK icon in the systray. Works like a charm. THANK you.

Now that I know the method, I can see that is exactly what you suggested in the example at the bottom of your very long post on Oct 20, 11.34pm, and the principle you repeated a post or two later. MY APOLOGIES.

I have have even managed to adapt your Win-k to my list

Edited by Basty, 21 October 2010 - 03:47 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP