2017-09-25 81 views
0

我不知道如何做到這一點。我在論壇和外部進行了很多調整,但我無法解決這個問題。 我想把在「IVA」變量中加入的文本放到網站上的文本框中。 我搜索文本框的id是:F1:j_idt144通過文本框中的變量

這是代碼的最後一部分:

tell application "Numbers" 
    activate 
    set a to "A" 
    set b to "B" 
    set c to "C" 
    set d to "D" 
    set e to "E" 
    set f to "F" 
    set y to "1" 
    repeat 5 times 
     tell application "Numbers" 
      activate 
      tell table 1 of sheet 1 of document 1 
       --display dialog a & y 
       set y to y + 1 
       set az to a & y 
       set bz to b & y 
       set dz to d & y 
       set ez to e & y 
       set fz to f & y 
       set the selection range to cell az 
       copy value of cell az to IVA 
       copy value of cell dz to CF 
       copy value of cell ez to import 
       copy value of cell fz to intestatario 
       copy value of cell bz to giorno 
       display dialog IVA & " , " & CF & " , " & import & " , " & intestatario & " , " & giorno 
       delay 1 
      end tell 
     end tell 
     tell application "Safari" 
      activate 
      do JavaScript "document.getElementsById('f1:j_idt144')[0].click();" in document 1 
      delay 1 
      tell the application "System Events" to keystroke IVA 
      delay 2 
     end tell 

    end repeat 
    -- attivare 
    display notification "FINISHED" sound name "Glass" with title "#Tag Liker" 
end tell 
+0

你嘗試填充文本字段僅使用JavaScript? – rachit

+0

mmm我不知道java腳本...你知道如何處理java腳本? –

+0

做JavaScript「document.getElementsById('f1:j_idt144')[0] .value ='dateon一個excell的單元格';」在文檔1 – rachit

回答

0

試試這個

tell application "Safari" 
    activate 
    set javascriptString to "document.getElementsById('f1:j_idt144')[0].value='" & IVA & "';" 
    do JavaScript javascriptString in document 1 
    delay 1 
    tell the application "System Events" to keystroke IVA 
    delay 2 
end tell 
+0

@AlessandroSimon是否有效? – rachit