• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trying to keep a set-up windows open.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to keep a set-up windows open.


  • Subject: Re: Trying to keep a set-up windows open.
  • From: Brian Christmas <email@hidden>
  • Date: Tue, 09 Dec 2014 09:08:32 +1100

Well, I’m trying to get Phils method to work, it seems just what I need.

my code is…

my setAssistWindowPosition(windowAssistiveAccess)

on setAssistWindowPosition(sender)
try
set p to 1
set newX to (current application's (NSScreen()'s mainScreen()'s visibleframe()'s origin()'s x)) + (current application's (NSScreen()'s mainScreen()'s visibleframe()'s |size|()'s width)) - (sender's frame()'s |size|()'s width) - 5
set p to 2
set newY to (current application's (NSScreen()'s mainScreen()'s visibleframe()'s origin()'s y)) + (current application's (NSScreen()'s mainScreen()'s visibleframe()'s |size|()'s height)) - (sender's frame()'s |size|()'s height) - 5
windowAssistiveAccess's setFrameOrigin:{newX as integer, newY as integer}
on error errmsg
display dialog "setAssistWindowPosition " & errmsg & "p=" & p
end try
end setAssistWindowPosition


but it returns an error ‘Can’t continue NSScreen’.

I’ve exhausted my knowledge, and tried everything I know of, so hopefully someone can set me straight, please.

Regards

Santa


On 9 Dec 2014, at 12:09 am, sphil <email@hidden> wrote:

Now I just need to figure out how to set the position of my advice window right next to the Assistive devices preferences window. Fun.

Hi Brian, again apologies for the lack of translation, but here's a cocoa method I use for doing just that.

This places the window upper top right, right underneath the spotlight/notificaitions menu bar icons. Adust it leftwards and downwards by increasing those two numbers -5 and -5 (by increase I really mean decrease, in a mathematical sense: eg. -100 and -100 will make it further left and further down!).

You then call the method on your window with something like

[myWindow setWindowPosition];

immediately after the line that tells the window to open.


- (void)setWindowPosition {

   NSPoint pos;
    pos.x = [[NSScreen mainScreen] visibleFrame].origin.x + [[NSScreen mainScreen] visibleFrame].size.width - [[self window] frame].size.width -5;
    pos.y = [[NSScreen mainScreen] visibleFrame].origin.y + [[NSScreen mainScreen] visibleFrame].size.height - [[self window] frame].size.height -5 ;
    [[self window] setFrameOrigin : pos];

}



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Trying to keep a set-up windows open. (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Trying to keep a set-up windows open.
  • Next by Date: Re: Is there an easier way?
  • Previous by thread: Re: Trying to keep a set-up windows open.
  • Next by thread: Re: Attributed text problem
  • Index(es):
    • Date
    • Thread