开发者

Set bounds of Screen Sharing window no longer working in Lion

I use my Mac Mini to play movies and music on while working on my M开发者_如何转开发BP. I like to keep screen sharing open but reduced in size in the upper right corner of my screen so that I can effectively have a "PIP". When I want to tag a song that is playing or change the movie, I use a key command to make the window full size, then another key command to shrink it back and position it in the upper right corner.

Since I updated to Lion, I've been getting the following error:

error "Screen Sharing got an error: Can’t set window 1 to {1191, 22, 1441, 185}." number -10006 from window 1

The code is below. Does anyone know what I'm doing wrong?

tell application "Screen Sharing"
    activate
    set the bounds of the first window to {1191, 22, 1441, 185}
end tell

I have also tried changing the code to use the wording "set the bounds of window 1..." but get the same error.

Any help would be much appreciated.

--Adam


If you look at the applescript dictionary for the application, it doesn't know those commands (e.g.. window or bounds). It only knows the GetURL command so it certainly won't work.

However there is another option. System Events knows about windows and it knows the size and position commands. So you can use that instead...

tell application "System Events"
    set ssProcess to first process whose name is "Screen Sharing"
    tell ssProcess
        tell first window
            set position to {0, 20}
            set size to {605, 400}
        end tell
    end tell
end tell
tell application "Screen Sharing" to activate
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜