0

次のコードを使用して、applescript で Google クエリを使用して YouTube を開きます。これは、新しい Google が検索文字列を YouTube に転送しないためです。よろしくお願いします。よろしくお願いします。

ここでエラーが発生します:

tell application "Firefox" to activate
tell application "System Events"
    keystroke "l" using command down
    keystroke "c" using command down

    set tr to get the clipboard


end tell



return trimgoogle(tr)
on trimgoogle(sourceAddress)
    set AppleScript's text item delimiters to {"#"}
    set addressParts to (every text item in sourceAddress) as list
    set AppleScript's text item delimiters to ""
    set nameOnly to item 2 of addressParts

    set AppleScript's text item delimiters to {"&"}
    set addressParts2 to (every text item in nameOnly) as list
    set AppleScript's text item delimiters to ""
    set nameOnly1 to item 1 of addressParts2
    set nameOnly2 to nameOnly1


    set AppleScript's text item delimiters to {"="}
    set addressParts21 to (every text item in nameOnly2) as list
    set AppleScript's text item delimiters to ""
    set nameOnly12 to item 2 of addressParts21


    set newurl to "http://www.youtube.com/results?search_query=" & nameOnly12

    return newurl

end trimgoogle

tell application "Firefox"
OpenURL  newurl
end tell
4

1 に答える 1