8

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

4

4 回答 4

17

在 AutoHotkey 中,序列

`n

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

例如:

MsgBox, "line1`nline2`nline3"

产生如下输出:

line1
line2
line3
于 2013-03-31T01:58:49.347 回答
2

你想要一个续节

这是一个示例脚本:

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

输出:

在此处输入图像描述

于 2019-10-29T23:01:47.467 回答
2

备选方案#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
于 2020-01-07T21:16:13.857 回答
0

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

> `r`

喜欢:

::@ph::Content-Type:application/json rX-Auth-Token:

于 2020-01-14T03:54:56.647 回答