开发者

applescript buttons

开发者 https://www.devze.com 2023-01-27 05:55 出处:网络
I have followed this youtube tutorial: http://www.youtube.com/watch?v=0ux3S_G8HuU I want the second button go to a special website....

I have followed this youtube tutorial: http://www.youtube.com/watch?v=0ux3S_G8HuU

I want the second button go to a special website....

I have tried this:

if "button 2" then open location "(the name of the s开发者_开发百科ite)"

What do I do? I hope you can help.


Try this:

set search to (display dialog "Enter YouTube Video Search" default answer "" buttons {"Cancel", "Search", "Search2"} default button 3)
set keyword to text returned of search
set buttonPressed to button returned of search

if buttonPressed is equal to "Search" then
tell application "Safari"
    open location "http://www.youtube.com/results?search_query=" & keyword
end tell
else if buttonPressed is equal to "Search2" then
tell application "Safari"
    open location "http://www.youtube.com/results?search_query=" & keyword
end tell
end if

Just change the URLs to whatever you want for Search or Search2.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号