Inserting a hard return within a macro?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
compumom
Posts: 5
Joined: 01 Jul 2015, 02:54

Inserting a hard return within a macro?

01 Jul 2015, 03:31

I'm very new to this, using AHK for macros and autocorrection and loving it.

There are instances when I need to insert something including key combinations, odd characters at the line beginnings, and a hard return inside it. For example:


#0:04:12 (A time stamp, which is produced with Ctrl-G within the player and Ctrl-V, and already includes the # character)
~Interviewer:
^

just like that, on lines 1, 2, 3.

If anyone can educate me on how that would be done, I will be most grateful. Thanks!
Guest

Re: Inserting a hard return within a macro?

01 Jul 2015, 03:50

Study the various examples in the docs here http://ahkscript.org/docs/Hotstrings.htm#continuation
If you want to position your caret you can add Send, {left X} where X is the number of times you have to press left to place your caret on the desired location.
compumom
Posts: 5
Joined: 01 Jul 2015, 02:54

Re: Inserting a hard return within a macro?

01 Jul 2015, 04:14

Thanks - but way over my head. :P
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Inserting a hard return within a macro?

03 Jul 2015, 01:38

If that's over your head, your head must be buried. :?

In all seriousness, just look at the first example under "Long Replacements" (which the link points to). It's very simple: a hotstring with a simple abbreviation, followed by multi-line replacement text.
User avatar
T_Lube
Posts: 67
Joined: 22 Oct 2014, 00:57

Re: Inserting a hard return within a macro?

03 Jul 2015, 02:45

:terms: Basically you need to read the docs
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Inserting a hard return within a macro?

03 Jul 2015, 19:59

Actually, you'll also need the r0 option to disable raw mode as described below the example, in order to send Ctrl-G (^g) and Ctrl-V (^v).


T_Lube, you're not helping. If everyone could and would get the right answers by reading documentation, the forums would be much less active.
User avatar
T_Lube
Posts: 67
Joined: 22 Oct 2014, 00:57

Re: Inserting a hard return within a macro?

03 Jul 2015, 23:05

Lexikos, You make a valid point. Though you do have to admit some people show up just wanting a script, without learning a thing. I can also say that asking for clarification a on a documentation piece and asking for the simplest of answers are 2 different things.

However I do trust you to make the call on this, I know you have helped me before in the past with my sometimes ridiculous questions.
User avatar
rommmcek
Posts: 1473
Joined: 15 Aug 2014, 15:18

Re: Inserting a hard return within a macro?

04 Jul 2015, 03:21

Hi, compumom

You must learn: The life is hard!

To help you: Just copy or download suggested scripts save & run them. Type text1 or btw respectively followed by colon and you will see the magic. Afterwards modify the scripts to suit you best.

But above all, read the instructions, twice or more if once is not enough! If you don't understand this today try tomorrow once again!

Good luck!

P.s.:

Code: Select all

^g::
Clipboard := chr(35)
Send ^v
Send `n
Clipboard := chr(94)
Send ^v
return
I'm not a programer, but sometimes I find usable workarounds!

P.p.s.: Just noticed, there was a typo in third paragraph. (red: colon of course, not semicolon)
Last edited by rommmcek on 04 Jul 2015, 10:44, edited 3 times in total.
compumom
Posts: 5
Joined: 01 Jul 2015, 02:54

Re: Inserting a hard return within a macro?

04 Jul 2015, 03:33

Thank you very much. You're right, life is hard, but God is good. I'm a 61-year-old grandmother with Asperger's doing transcription to survive, and while I know how to assemble and disassemble hardware and build a PC from scratch, I've never had the opportunity to learn any programming. I learn best through starting with an answer and working backwards to the question, and I greatly appreciate your kindness and help.
Guest
Posts: 57
Joined: 17 Oct 2013, 02:32

Re: Inserting a hard return within a macro?

04 Jul 2015, 04:57

If you haven't already done so, try to read and test the examples in the Beginners Tutorial, http://ahkscript.org/docs/Tutorial.htm that should give you a basic understanding of how scripts are setup, the difference between hotstrings and hotkeys and a few other basic concepts.
If you try each example you should be able to get the hang of it pretty soon.

If you are typing a lot there is a very elaborate script called TypingAid - a word autocompletion utility - http://ahkscript.org/boards/viewtopic.php?f=6&t=5644
User avatar
rommmcek
Posts: 1473
Joined: 15 Aug 2014, 15:18

Re: Inserting a hard return within a macro?

04 Jul 2015, 10:35

I was superficial, reading your question & answering to it. Try once more example above, which was edited!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998, ReyAHK and 250 guests