JS提示在新的safari窗口中打开

JS prompt open in new safari window?

本文关键字:窗口 safari 提示 JS      更新时间:2023-09-26

下面的脚本在一个新的选项卡中打开一个带有文本的JS提示,我希望它只在新窗口中做同样的事情。为了实现这一点,我需要改变什么?

    set searchTerm to “ebay”
    do shell script "/usr/bin/osascript -e 'delay 1' -e 'tell application '"System         Events'" to keystroke '"" & searchTerm & space & "'"' > /dev/null 2>&1 &"
    tell application "Safari"
        activate
        set newTab to make new tab in window 1
        set current tab of window 1 to newTab
        do JavaScript         "javascript:Qr=prompt('','');if(Qr)location.href='http://www.yubnub.org/parser/parse?        command='+escape(Qr)" in current tab of first window
    end tell

您所需要做的就是制作一个新的文档

set searchTerm to "ebay"
do shell script "/usr/bin/osascript -e 'delay 1' -e 'tell application '"System         Events'" to keystroke '"" & searchTerm & space & "'"' > /dev/null 2>&1 &"
tell application "Safari"
    activate
    set thisWindow to make new document
    tell thisWindow to do JavaScript "javascript:Qr=prompt('','');if(Qr)location.href='http://www.yubnub.org/parser/parse?        command='+escape(Qr)"
end tell

作者所能做的一切都不能选择在新窗口而不是新选项卡中打开。