2017-09-25 44 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