Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert a line break in Autohotkey message box text

Tags:

autohotkey

Is it actually possible to insert a line break in a message box text? I have searched far and wide and everybody talks about 'n or \n but that does not work. Can anyone give me an example of code that actually works?

like image 637
user2157155 Avatar asked Mar 31 '13 01:03

user2157155


3 Answers

In AutoHotkey, the sequence

`n

(a backtick followed by an n) indicates a newline.

For instance:

MsgBox, "line1`nline2`nline3"

Produces an output like:

line1
line2
line3
like image 63
Jared Ng Avatar answered Oct 18 '22 02:10

Jared Ng


You want a continuation section.

Here's an example script:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

lorem = 
(
Lorem ipsum dolor sit? Knowin' embark a sword tharrr. Much bucket har, avast, Flying Dutchmen shaft craft legend sails runnin'. Poopdeck barrel shaft, scimitar captain brothel. West poopdeck cannon-ball gunpowder deck. Much kill sink many scalawag. Davey east direction davey shaft direction avast scimitar off drunk travel, crew. Bottle scurvy, pirates a. 

Strike stars, mast treasure. Arrrgh, boom bow strike her crows-nest brothel, bar be. 'Til ahoy bow smuggle stars crew mast myth head. Wreck many, bar sea scimitar har harbor. Other sea west bread death, raft poopdeck locker be matey ahoy? 

Embark explosion patch scalawag washed-up rudder pirate devil be, mast, with. Raft death shipment drink, those. Myth raid east, Kraken stars raid cannon-ball with scimitar gold, avast. Bread together runnin'? Be dispatch, her ahoy be Flying Dutchmen. Ahoy bread myth. Flying Dutchmen vessel bottle, poopdeck.
)

msgbox %lorem%

Output:

enter image description here

like image 27
burque505 Avatar answered Oct 18 '22 04:10

burque505


Alternative #1: Call Msgbox with "( )" around your data.

Msgbox,
(
    SUMMARY:
    ========================
    TOTAL : ALL______: %ALL%
    TOTAL : NON_BLANK: %TOT%
    BLANK : B4    TRM: %B_F%
    BLANK : AFTER TRM: %BAT%
    DUPES :__________: %NTS% ;;num_tok_skip
    UNIQUE:__________: %NTA% ;;num_tok_added
    ========================
)
;; Above prints out a table of values: ALL, TOT, B_F, BAT, NTS, NTA
;; The are variables defined elsewhere in my code I wanted a printout 
;; in table from of.

Alternative #2: Here is an alternate method I use when creating blocks of text to be pasted from autohotkey. I just like the "CHR" command more than the back ticks.

global cr_char := CHR(13)  ;AKA:  'r (return char)
global lf_char := CHR(10)  ;AKA:  'n (newline char)
global windows_newline := cr_char . lf_char
like image 2
twitchdotcom slash KANJICODER Avatar answered Oct 18 '22 04:10

twitchdotcom slash KANJICODER