あるプログラム (IE) から電子メールの件名フィールドにコピーされるはずの文字列に、次のような間違いが含まれていることがあります。
ただし、変数 subject のメッセージ ボックス (以下を参照) は常に正しいものです。
subject= %protocol% , %LSN% , %Site% , %Requisition%
ただし、コードを実行すると:
10 回に 1 回、件名フィールド内に文字列が正しく配置されていません。
私が期待する:
プロトコル C16019、LSN (102707)、サイト 22902、要求 102921403
私は得る:
プロトコル c16019 (大文字の C の代わりに小文字の C )、lSN (&02707° ( 1 の代わりに %、の代わりに °) )、サイト é2902 ( 2 の代わりに é )、要求 &02921403(1 の代わりに &)
AHK が私の特殊文字 (F1-F12 キーの下の文字行) を使用しているか、シフト ボタンがアクティブになっているようです。
これを解決する理由と方法を教えてください。
私はどこかで、controlsendが常に機能するとは限らず、それは既知の問題であることを読みました。
補足: 電子メール アドレスの @ が常に送信先フィールドに入力されていない別のスクリプトでも、これを確認しています。
私のコード:
Home::
pwb := WBGet()
pTable:= pwb.document.GetElementsByTagName("Table") [4] ;outerHTML ;Set Tag name and Array value
Loop, % pTable.rows.length {
LSN_1:= pTable.rows[9] .GetElementsByTagName("TD") [1].outerHTML ; LSN
protocol_1:= pTable.rows[9] .GetElementsByTagName("TD") [3].outerHTML ; Protocol
Site_1:=pTable.rows[10] .GetElementsByTagName("TD") [1].outerHTML ; Site
Requisition_1:=pTable.rows[12] .GetElementsByTagName("TD") [3].outerHTML ; Requisition
StringTrimLeft, NLSN, LSN_1, 6 ;trims 6 characters from left ( <TD> >)
StringTrimRight, fLSN, NLSN, 5 ;trims 5 characters from right (<TD> )
StringTrimLeft, Nprotocol, protocol_1, 6
StringTrimRight, fprotocol, Nprotocol, 5
StringTrimLeft, Nsite, site_1, 6
StringTrimRight, fsite, Nsite, 5
StringTrimLeft, NRequisition, Requisition_1, 6
StringTrimRight, fRequisition, NRequisition, 5
Requisition= requisition %fRequisition%
sleep,10
LSN= LSN (%fLSN%) ; essential that this variable is put into brackets
sleep,10
Site= site %fsite% ; "site" has to be put before the string
sleep,10
Protocol= protocol %fprotocol% ;"protocol" has to be put before the string
sleep,10
subject= %protocol% , %LSN% , %Site% , %Requisition%
sleep,150
;the variable in Msgbox is always correct here
;send the contents of subject into the subject of outlook
controlFocus, RichEdit20WPT4, ahk_class rctrl_renwnd32
controlSend, RichEdit20WPT4, {end} , ahk_class rctrl_renwnd32 ; send to the end of subject field
controlSendRaw, RichEdit20WPT4, %subject%, ahk_class rctrl_renwnd32
sleep,100
subject :=""
return
}
文字列は 10% ~ 20% の確率で正しくありません。
注意してください、私はまったくの初心者です。スクリプトの作成を学び、約 2 週間試してみました。このスクリプトが常に 100% 機能しない理由がわかりません。