Autohotkey:删除字符串,在主题框中放置字符串
Auothotkey: Remove string, placement string in subject box
有人可以帮我看看为什么我的代码不起作用吗?
我的代码:
#b::
pwb := WBGet()
pTable:= pwb.document.GetElementsByTagName("Table") [4] ;outerHTML ;Set Tag name and Array value
Loop, % pTable.rows.length {
LSN:= pTable.rows[9] .GetElementsByTagName("TD") [1].outerHTML ; LSN
protocol:= pTable.rows[9] .GetElementsByTagName("TD") [3].outerHTML ; Protocol
Site:=pTable.rows[10] .GetElementsByTagName("TD") [1].outerHTML ; Site
Requisition:=pTable.rows[12] .GetElementsByTagName("TD") [3].outerHTML ; Requisition
subject= %protocol% , %LSN% , %site% , %Requisition%
;send the contents of subject into the subject of outlook
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32 ;send to the end of the subject field
controlSendRaw, RichEdit20WPT4, %subject%, ahk_class rctrl_renwnd32 ; sent to the subject field
subject :="" ; empty the variable after process completed
return
} "
我想将变量 subject= %protocol% , %LSN% , %site% , %requisition% 发送到 the end 我电子邮件主题字段中的某些文本。
但是我有两个问题:
- 我在主题字段中得到以下信息:<TD>SP005 VIABLE , 101999 , C277 , 103484490
如何删除 TD?
- 我没有在某个文本 的末尾 获得变量,但是在文本 的开头 。
因此 <TD>SP005 VIABLE , 101999 , C277 , 103484490 - 查询不符信息
为什么?
我以为下面的代码会发送特定文本后面的变量?
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32
而不是:
LSN := pTable.rows[9].GetElementsByTagName("TD")[1].outerHTML
尝试:
LSN := pTable.rows[9].GetElementsByTagName("TD")[1].innerText
Here's an explanation.
如果不行你可以试试StringReplace:
StringReplace, LSN, LSN, <TD>,, ALL
至于你的代码没有将你的文本发送到你文档的 End 尝试 ControlFocus, ControlClick, and Sleep
;Set focus on Control
controlFocus, RichEdit20WPT4, ahk_class rctrl_renwnd32
;MouseClick on the Control, set the Caret!
controlClick, RichEdit20WPT4, ahk_class rctrl_renwnd32
;Pause for a millisecond
Sleep, 10
;Move Caret to end of document!
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32
Sleep, 10
等..
有人可以帮我看看为什么我的代码不起作用吗?
我的代码:
#b::
pwb := WBGet()
pTable:= pwb.document.GetElementsByTagName("Table") [4] ;outerHTML ;Set Tag name and Array value
Loop, % pTable.rows.length {
LSN:= pTable.rows[9] .GetElementsByTagName("TD") [1].outerHTML ; LSN
protocol:= pTable.rows[9] .GetElementsByTagName("TD") [3].outerHTML ; Protocol
Site:=pTable.rows[10] .GetElementsByTagName("TD") [1].outerHTML ; Site
Requisition:=pTable.rows[12] .GetElementsByTagName("TD") [3].outerHTML ; Requisition
subject= %protocol% , %LSN% , %site% , %Requisition%
;send the contents of subject into the subject of outlook
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32 ;send to the end of the subject field
controlSendRaw, RichEdit20WPT4, %subject%, ahk_class rctrl_renwnd32 ; sent to the subject field
subject :="" ; empty the variable after process completed
return
} "
我想将变量 subject= %protocol% , %LSN% , %site% , %requisition% 发送到 the end 我电子邮件主题字段中的某些文本。
但是我有两个问题:
- 我在主题字段中得到以下信息:<TD>SP005 VIABLE , 101999 , C277 , 103484490
如何删除 TD?
- 我没有在某个文本 的末尾 获得变量,但是在文本 的开头 。
因此 <TD>SP005 VIABLE , 101999 , C277 , 103484490 - 查询不符信息
为什么?
我以为下面的代码会发送特定文本后面的变量?
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32
而不是:
LSN := pTable.rows[9].GetElementsByTagName("TD")[1].outerHTML
尝试:
LSN := pTable.rows[9].GetElementsByTagName("TD")[1].innerText
Here's an explanation.
如果不行你可以试试StringReplace:
StringReplace, LSN, LSN, <TD>,, ALL
至于你的代码没有将你的文本发送到你文档的 End 尝试 ControlFocus, ControlClick, and Sleep
;Set focus on Control
controlFocus, RichEdit20WPT4, ahk_class rctrl_renwnd32
;MouseClick on the Control, set the Caret!
controlClick, RichEdit20WPT4, ahk_class rctrl_renwnd32
;Pause for a millisecond
Sleep, 10
;Move Caret to end of document!
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32
Sleep, 10
等..