2017-09-30 30 views
0

吧我就可以開始用下面的AppleScript一個「查找」操作:的AppleScript輸入要查找的文本瀏覽器

activate application "Firefox" 
tell application "System Events" 
    tell process "Firefox" 
     click menu item "Find" of menu 1 of menu bar item "Edit" of menu bar 1 
    end tell 
end tell 

我怎樣才能再輸入一個字符串查找搜索?

回答

1
activate application "Firefox" 
tell application "System Events" 
    tell process "Firefox" 
     click menu item "Find" of menu 1 of menu bar item "Edit" of menu bar 1 
    end tell 
    keystroke myString 
    keystroke return 
end tell 
+0

謝謝。這是有效的,但是你是否也知道點擊查找欄中的項目的方法,或者檢查它是否已經有文本?我的最終目標是將腳本分配給一個鍵綁定,以便我可以在一個命令中同時具有「查找」和「再次查找」。 – dangom

+0

不確定您是否可以使用applescript在Firefox中運行JavaScript。在safari中有一個選項可以運行js。 或者,您可以再次使用command down來執行「keystroke」f「,然後繼續執行」keystroke return「來查找下一個項目。 – rachit