Changing specific words in a given script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ebirben1
Posts: 1
Joined: 02 Jun 2022, 13:19

Changing specific words in a given script

02 Jun 2022, 13:25

Hello guys,

First of all, let me give you a quick background before asking my question. I have a job where I have to edit a lot of similar looking documents. However, each of these documents are intended for different people/ entities. I already use autohotkey for the scripts and it has done wonders to me. Now I'd like to advance on this a little bit, this is what I am trying to do:

Let's take an example of what I do for subjects of an email. I write "emailsubject" and I get "Project [ ]// Comments" in return.

What I'd like to do is, for example, write "emailsubjectKing" and get King within the brackets. In order words, "Project [King]// Comments".

If I write emailsubjectMichael, I'd like to get Project [Michael]// Comments.

Please note that I'm using notepad to code, so a typical script for me is:

::emailsubject::Project [x]// Comments
return

Thank you very much in advance.
User avatar
sinkfaze
Posts: 616
Joined: 01 Oct 2013, 08:01

Re: Changing specific words in a given script

02 Jun 2022, 13:37

Probably the most simple way around it would be this:

Code: Select all

::emailsubject::
InputBox, out, Enter Text, Enter the deisred text for your hotstring., , , , , , , 10
if	(ErrorLevel>0)
	return
Send Project [%out%] // Comments
return
RussF
Posts: 1296
Joined: 05 Aug 2021, 06:36

Re: Changing specific words in a given script

02 Jun 2022, 16:35

Try this:

Code: Select all

:*:emailsubject::Project []// Comments{Left 12}
Return
Since you would have to type the name anyway, this just places the cursor between the brackets after you type the hotstring, so you would just immediately type the name.

Russ

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 195 guests