Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 若列表中存在下一项,则使用applescript_Macos_Google Chrome_Url_Applescript - Fatal编程技术网

Macos 若列表中存在下一项,则使用applescript

Macos 若列表中存在下一项,则使用applescript,macos,google-chrome,url,applescript,Macos,Google Chrome,Url,Applescript,这是我的第一本苹果书。我希望能够使用一个循环,在列表中没有其他元素时,继续下一步,以尽可能多地说明项目。我的版本现在只包含两个文本项。提前谢谢你 set userone to text returned of (display dialog "Job IDs Please" default answer "" buttons {"Submit", "Cancel"} default button 1) set oldDelimiters to AppleScript's text item d

这是我的第一本苹果书。我希望能够使用一个循环,在列表中没有其他元素时,继续下一步,以尽可能多地说明项目。我的版本现在只包含两个文本项。提前谢谢你

set userone to text returned of (display dialog "Job IDs Please" default answer "" buttons {"Submit", "Cancel"} default button 1)

set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set urllist to every text item of userone

set joburl to "http://crowdflower.com/jobs/"
set urlcrowds to urllist
copy urllist to urlcrowds
set item 1 of urlcrowds to joburl & 1st item of urllist
set item 2 of urlcrowds to joburl & 2nd item of urllist

get urlcrowds

tell application "Google Chrome"

activate

make new window

set myTab to make new tab at end of tabs of window 1

set URL of myTab to item 1 of urlcrowds

set myTab to make new tab at end of tabs of window 1

set URL of myTab to item 2 of urlcrowds

close tab 1 of window 1

end tell

非常感谢你

您可以使用重复循环:

set l to {12379081, 3785788, 3351991}
tell application "Google Chrome" to tell (make new window)
    repeat with i in l
        set u to "http://crowdflower.com/jobs/" & i
        make new tab at end of tabs with properties {URL:u}
    end repeat
    close tab 1
end tell

打开位置
不会打开新的选项卡页:

repeat with i in words of "12379081 3785788 3351991"
    open location "http://crowdflower.com/jobs/" & i
end repeat
您也可以在终端中运行类似的操作:

open http://crowdflower.com/jobs/{12379081,3785788,3351991} -a Google\ Chrome

令人惊叹的!终端解决方案非常棒!我很感激!