0
나는 새로운 구글이 유튜브에 내 검색 문자열을 가지고 다니지 않아서 애플 스크립트에서 구글 쿼리로 유튜브를 열려면 아래 코드를 사용하고 있습니다 .Unable에서 구글 검색 문자열로 firefix에서 URL을 열려면 파이어 폭스. 나는 정말로 도움을 주셔서 감사합니다. 미리 감사드립니다.유튜브에서 구글 검색 쿼리를 열려면 applescript
여기에 오류가 점점 오전 :
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
! 코드에 오류가 없습니다. 그러나 새 창 (탭이 열리지 않음). – jason
하드 코드 된 URL로 시도해보십시오. 작동하는 경우 URL (이 경우 "nameOnly12"의 내용)을 인코딩해야합니다. - 최신 Firefox를 사용하여 OS 10.8.2에서 다시 시도했으며 유효한 위치 인 –
을 열어 newurl을 글로벌로 만들었습니다. newurl을 글로벌하게 만들지 않고 다른 방법으로 말해 줄 수 있습니까 ?? – jason