如何在Autohotkey消息框文本中插入换行符

时间:2013-03-31 01:53:47

标签: autohotkey

是否可以在消息框文本中插入换行符? 我搜索了很多,每个人都谈论'n或\ n但这不起作用。 任何人都可以给我一个实际有效的代码示例吗?

4 个答案:

答案 0 :(得分:7)

在AutoHotkey中,序列

`n

(后跟一个n的反引号)表示换行符。

例如:

MsgBox, "line1`nline2`nline3"

生成输出,如:

line1
line2
line3

答案 1 :(得分:0)

您想要一个continuation section

这是一个示例脚本:

#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%

输出:

enter image description here

答案 2 :(得分:0)

替代方法1::在数据周围用“()”调用Msgbox。

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.

替代#2: 这是我创建要从自动快捷键粘贴的文本块时使用的另一种方法。我更喜欢“ CHR”命令,而不是后面的勾。

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

答案 3 :(得分:0)

您可以在反引号中使用“ r”。

> `r`

喜欢:

:: @ ph :: Content-Type:application / json r X-​​Auth-Token: