Skip to main content
added 15 characters in body
Source Link
Tetsujin
  • 117.7k
  • 26
  • 201
  • 346

I want to move the position of a current window 5 pixels up, and 5 pixels right.
I have found code to move a window to a fixed position.
I have found code to get the position of a window.
I can't figure out how to get it all to work together.
I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one.
Here's what I have so far, which works but uses a fixed position only.

set delta to 5
set screenOneXOffset to -120
set screenOneYOffset to -1300
tell application "System Events"
        set position of first window of application process "Google Chrome" to ¬  
    {screenTwoXOffset + delta, screenOneYOffset + delta}
end tell

How to get the position of a window (but then not sure how to use it):

tell application "System Events" to get properties of window 1 of application process "RStudio"

I want to move the position of a current window 5 pixels up, and 5 pixels right.
I have found code to move a window to a fixed position.
I have found code to get the position of a window.
I can't figure out how to get it all to work together.
I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one.
Here's what I have so far, which works but uses a fixed position only.

set delta to 5
set screenOneXOffset to -120
set screenOneYOffset to -1300
tell application "System Events"
        set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta}
end tell

How to get the position of a window (but then not sure how to use it):

tell application "System Events" to get properties of window 1 of application process "RStudio"

I want to move the position of a current window 5 pixels up, and 5 pixels right.
I have found code to move a window to a fixed position.
I have found code to get the position of a window.
I can't figure out how to get it all to work together.
I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one.
Here's what I have so far, which works but uses a fixed position only.

set delta to 5
set screenOneXOffset to -120
set screenOneYOffset to -1300
tell application "System Events"
    set position of first window of application process "Google Chrome" to ¬  
    {screenTwoXOffset + delta, screenOneYOffset + delta}
end tell

How to get the position of a window (but then not sure how to use it):

tell application "System Events" to get properties of window 1 of application process "RStudio"
added 36 characters in body
Source Link
Tetsujin
  • 117.7k
  • 26
  • 201
  • 346

I want to move the position of a current window 5 pixels up, and 5 pixels right. 
I have found code to move a window to a fixed position. 
I have found code to get the position of a window. 
I can't figure out how to get it all to work together. 
I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one. 
Here's what I have so far, which works but uses a fixed position only.

Thanks

set delta to 5 set screenOneXOffset to -120 set screenOneYOffset to -1300 tell application "System Events" set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta} end tell

set delta to 5
set screenOneXOffset to -120
set screenOneYOffset to -1300
tell application "System Events"
        set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta}
end tell

How to get the position of a window (but then not sure how to use it): tell application "System Events" to get properties of window 1 of application process "RStudio"

tell application "System Events" to get properties of window 1 of application process "RStudio"

I want to move the position of a current window 5 pixels up, and 5 pixels right. I have found code to move a window to a fixed position. I have found code to get the position of a window. I can't figure out how to get it all to work together. I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one. Here's what I have so far, which works but uses a fixed position only.

Thanks

set delta to 5 set screenOneXOffset to -120 set screenOneYOffset to -1300 tell application "System Events" set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta} end tell

How to get the position of a window (but then not sure how to use it): tell application "System Events" to get properties of window 1 of application process "RStudio"

I want to move the position of a current window 5 pixels up, and 5 pixels right. 
I have found code to move a window to a fixed position. 
I have found code to get the position of a window. 
I can't figure out how to get it all to work together. 
I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one. 
Here's what I have so far, which works but uses a fixed position only.

set delta to 5
set screenOneXOffset to -120
set screenOneYOffset to -1300
tell application "System Events"
        set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta}
end tell

How to get the position of a window (but then not sure how to use it):

tell application "System Events" to get properties of window 1 of application process "RStudio"
Source Link

Applescript to move a window relative to it's current position

I want to move the position of a current window 5 pixels up, and 5 pixels right. I have found code to move a window to a fixed position. I have found code to get the position of a window. I can't figure out how to get it all to work together. I can imagine doing this either by getting the window position into a variable and using the result, or by a position relative command if there is one. Here's what I have so far, which works but uses a fixed position only.

Thanks

set delta to 5 set screenOneXOffset to -120 set screenOneYOffset to -1300 tell application "System Events" set position of first window of application process "Google Chrome" to {screenTwoXOffset + delta, screenOneYOffset + delta} end tell

How to get the position of a window (but then not sure how to use it): tell application "System Events" to get properties of window 1 of application process "RStudio"