【问题标题】:Applescript to input text in websiteApplescript 在网站中输入文本
【发布时间】:2014-01-09 20:41:37
【问题描述】:
set query to text returned of (display dialog "Enter Query" default answer "" buttons {"Input", "Cancel"} default button 1)

open location "http://www.soundcloud.com/"
delay 1
tell application "System Events"
    key code 48
end tell
delay 1
query

所以我正在尝试制作一个applescript:

1) 通过对话框提示输入数据

2) 打开网页

3) 按 Tab 键进入第一个文本框

4) 粘贴步骤 1 中的数据

我已经知道如何进入第 4 步,但是当我打印查询变量时,它只会在 AppleScript 中而不是网页中打印。

【问题讨论】:

    标签: automation applescript copy-paste paste


    【解决方案1】:
    set query to text returned of (display dialog "Enter Query" default answer "" buttons {"Input", "Cancel"} default button 1)
    
    open location "http://www.soundcloud.com/"
    delay 1
    tell application "System Events"
        key code 48
        delay 1
        keystroke query
    end tell
    

    我需要在命令行中添加击键

    【讨论】:

    • 请使用您问题上的编辑链接添加其他信息。 “发布答案”按钮应仅用于问题的完整答案。
    • 这并没有提供问题的答案。要批评或要求作者澄清,请在其帖子下方发表评论。
    【解决方案2】:

    试试这个:

    set query to text returned of (display dialog "Enter Query" default answer "" buttons {"Input", "Cancel"} default button 1)
    
    tell application "Safari"
        if not (exists document 1) then reopen
        activate
        set URL of document 1 to "http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi"
        delay 3
        do JavaScript "document.getElementsByName('SCREEN')[0].value=" & quoted form of query & "" in document 1
    end tell
    

    【讨论】:

      猜你喜欢
      • 2013-11-18
      • 1970-01-01
      • 1970-01-01
      • 2017-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多