【问题标题】:ControlSend Suppress Newlines When Sending Text to NotepadControlSend 在向记事本发送文本时禁止换行
【发布时间】:2018-08-13 05:33:07
【问题描述】:

我在使用 ControlSend 时遇到问题。当我尝试向记事本发送文本但 ControlSend 禁止换行时。 例如 它向记事本发送以下内容:

> <p style="font-size:50px;font-weight:900"></p>

而不是这个:

> ++++ 
> <p style="font-size:50px;font-weight:900"></p>
> ++++

我的代码(抱歉设计不佳):

append()
{ControlSend,Edit1,Clipboard,ahk_exe notepad.exe} ;Problem here

#If GetKeyState("Ctrl") && GetKeyState("Shift") 
{
e & h::
Title:= ""
InputBox, OutputVar ,"Title Level"
InputBox, HeadingName ,"Title Name"
if(OutputVar = 7)
{
Clipboard := "`n" . "++++" . "`n" . "<p style=""font-size:55px;font-weight:900"">" . HeadingName . "</p>" . "`n" . "++++" . "`n"
sleep 30
}

else if(OutputVar = 8)
{
Clipboard :="`n" . "++++" . "`n" . "<p style=""font-size:50px;font-weight:900"">++++" . HeadingName . "</p>" . "`n" . "++++" . "`n"
}

else if(OutputVar = 9)
{
Clipboard := "`n" . "++++" . "`n" . "<p style=""font-size:45px;font-weight:900"">" . HeadingName . "</p>" . "`n" . "++++" . "`n"
}

else if(OutputVar = 10)
{
Clipboard := "`n" . "++++" . "`n" . "<p style=""font-size:35px;font-weight:900"">" . HeadingName . "</p>" . "`n" . "++++" . "`n"
Sleep 30
}

else if(OutputVar = 11)
{
Clipboard := "`n" . "++++" . "`n" . "<p style=""font-size:30px;font-weight:900"">" . HeadingName . "</p>" . "`n" . "++++" . "`n"
}

else if(OutputVar = 12)
{
Clipboard := "`n" . "++++" . "`n" . "<p style=""font-size:25px;font-weight:900"">" . HeadingName . "</p>" . "`n" . "++++" . "`n"
}
sleep 30
append()
sleep 30
Return
;/...
}

我在剪贴板中也有额外的换行问题 例如:

它发送这个:

> [source]
> ----  
> x                                                                                           
> 
> y
> 
> z
> ----

而不是这个:

> [source]
> ----  
> x                                                                                           
> y
> z
> ----

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    阅读有关发送帮助的信息。 + 是一个特殊符号,如果要“按原样”发送字符串,请使用发送的原始模式。或者用 {} 大括号括起来特殊符号。

    【讨论】:

      猜你喜欢
      • 2010-10-06
      • 2021-11-08
      • 1970-01-01
      • 2015-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-03
      • 1970-01-01
      相关资源
      最近更新 更多