预期的行尾等,但找到标识符。指向JavaScript

预期的行尾等,但找到标识符。指向JavaScript,javascript,safari,window,applescript,tile,Javascript,Safari,Window,Applescript,Tile,找到了这个很棒的脚本,但无法运行。。。继续获取“预期的行尾等,但找到标识符。”错误指向“JavaScript”-第11节 --Tested only on a 17in Powerbook G4 running 10.4.8, Safari Version 2.0.4 tell application "Safari" -- For some reason Safari has (two?) invisible windows set allWindows to (every window w

找到了这个很棒的脚本,但无法运行。。。继续获取“预期的行尾等,但找到标识符。”错误指向“JavaScript”-第11节

--Tested only on a 17in Powerbook G4 running 10.4.8, Safari Version 2.0.4
tell application "Safari"

-- For some reason Safari has (two?) invisible windows
set allWindows to (every window where visible is true)

set n to count of allWindows

--This list will exclude all Source windows, and the Download window
set goodWindows to {}

repeat with x from 1 to n
set windowX to item x of allWindows
if (URL of document of windowX exists) then
set goodWindows to goodWindows & {windowX}
end if
end repeat

set n to count of goodWindows

-- Dividing by zero is bad
if n is 0 then return

-- If Downloads or Source window is frontmost, screenWidth and screenHeight will not be defined
set goodDoc to document of first item of goodWindows

-- Get dock position
set dock to do shell script "defaults read com.apple.dock orientation"

-- Get actual width of screen to help with left-side docks
tell application "Finder"
set screenSize to bounds of window of desktop
set actualWidth to item 3 of screenSize
end tell

-- Determine space open on your screen, factoring in the Dock
set screenWidth to do JavaScript "screen.availWidth" in goodDoc
set screenHeight to do JavaScript "screen.availHeight" in goodDoc

-- Get dock size
set dockSize to actualWidth - screenWidth

-- Get rid of pixel buffer on Dock
set screenHeight to screenHeight + 26

-- Determine desired width of each window
set windowWidth to (screenWidth / n)

-- Position each window in turn
repeat with x from 1 to n
tell item x of goodWindows
set index to 1 --Makes sure the Source and Downloads windows are behind the tiled ones
if (dock is not equal to "left") then --Coordinates are measured from the upper left corner, so the left-side dock is the special case

set bounds to {windowWidth * (x - 1), 21, windowWidth * x, screenHeight} -- 21 is the size of the Menu Bar (for 10.4 at least)

else
set bounds to {windowWidth * (x - 1) + dockSize, 21, windowWidth * x + dockSize, screenHeight}
end if
end tell
end repeat

end tell

需要正确的格式吗?脚本在10.9上运行良好(一旦我更新了获取停靠方向的方法)。该错误可能是由于Safari的AppleScript字典版本中不存在的术语造成的。在脚本编辑器中,当给出错误时,代码的哪一部分会突出显示?我不能对这张b/c太聪明,因为我没有访问这些(应用程序和操作系统)版本的权限。我猜Safari当时不支持“DoJavaScript”(或者以某种方式更改了实现)。它在雪豹(10.6.8)上运行良好。