Re: [AHK-] LOOP循環

看板EzHotKey作者 (胖克思)時間4年前 (2020/01/04 06:58), 4年前編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
不知道你是怎麼合併的 不過可以考慮直接把兩個TXT內容提取出來 建立兩個測試檔案: a.txt (內容:AAA`n BBB`n CCC) b.txt (內容:aaa`n bbb`n ccc`n ddd`n fff) 會: 點擊A欄位,輸入a.txt第n行的內容 點擊B欄位,輸入b.txt第n行的內容 按ENTER換行(切換分頁) https://youtu.be/6DQctRzn_Q8
應該可以正常運作,試試看吧 File_A := Getcontents("a.txt") File_B := Getcontents("b.txt") While !(File_A[A_index]="" and File_B[A_index]="") { if (File_A[A_index]!="") { ;~ MouseClick, left, ;欄位A send, % File_A[A_index] } if (File_B[A_index]!="") { ;~ MouseClick, left, ;欄位B send, % File_B[A_index] } send {enter} ; {CTRLDOWN}{TAB}{CTRLUP} } return Getcontents(filename :="a.txt") { Loop, Read, %filename% contents .= a_loopreadline "," StringTrimRight, contents, contents, 1 contents := StrSplit(contents, ",") return contents } ※ 引述《noirskakashi (楊安安)》之銘言: : 我常用兩種循環 : loop, read, C:\Users\user\Desktop\A.txt : { : SetKeyDelay, 150 : MouseClick, left, 欄位A : Send, %a_loopreadline% : Sleep, 800 : Send, {CTRLDOWN}{TAB}{CTRLUP} : sleep,500 : } : return : 內容大概是這樣,讀取A.txt寫入欄位A、讀取B.txt寫入欄位B、換頁後再重複一次 : 兩種循環差不多相似差在讀取的檔案不一樣 : 現在我想合在一起,有試過直接加進去或者用Gosub : 不過讀取B檔案時都只會讀到第一行 : 要如何讓他依序讀取下一行的數據? : 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.216.67.163 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/EzHotKey/M.1578092331.A.FBC.html ※ 編輯: panex0845 (61.216.67.163 臺灣), 01/04/2020 07:32:26
文章代碼(AID): #1U3ySh-y (EzHotKey)
討論串 (同標題文章)
文章代碼(AID): #1U3ySh-y (EzHotKey)