Is there a way to resize and reposition a quick look window with AppleScript? I have an AppleScript that will do this with any app, but I do not know what the quick look app is called.
I have tried QuickLook, Quick Look, and QL.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.
Sign up to join this communityHere's a little AppleScript I wrote to resize and reposition the Quick Look window so that it occupies the right one-third of the screen:
tell application "System Events"
if not (exists window "Quick Look") of process "Finder" then
activate application "Finder"
keystroke "y" using command down
end if
end tell
tell application "System Events" to tell process "Finder"
if not (exists window "Quick Look") then ¬
with timeout of 5 seconds
repeat until (exists window "Quick Look")
end repeat
end timeout
set [W, H] to size of scroll area 1 --(desktop)
tell window "Quick Look"
set [_w, _h] to size
set [_x, _y] to position
set position of it to [W * 2 / 3, 0]
set size of it to [W * 1 / 3, H]
end tell
end tell
This requires that the appropriate application from within which this script is run (e.g. Script Editor, Keyboard Maestro, Better Touch Tool, etc.) is given assistive accessibility permissions, which (in High Sierra) you can grant in System Preferences > Security & Privacy > Privacy > Accessibility.
your solution worked for me! I tried upvoting it to give you cred, but I'm a newbie. Also I modified it a bit as follows to meet my needs.
tell application "System Events"
if not (exists window "Quick Look") of process "Finder" then
activate application "Finder"
keystroke "y" using command down
end if
end tell
tell application "System Events" to tell process "Finder"
if not (exists window "Quick Look") then ¬
with timeout of 1 second
repeat until (exists window "Quick Look")
end repeat
end timeout
set [W, H] to size of scroll area 1 --(desktop)
tell window "Quick Look"
set [_w, _h] to size
set [_x, _y] to position
set position of it to [25, 50]
set size of it to [W - 50, H - 100]
end tell
end tell
I set the Y position to 50 because I think setting it to 0 makes the script try to put the Quick Look window behind the menu bar, and I don't think that's allowed. I'd like to tweak this a little more, but I don't know how to contact you directly or if you will even see this since it is a year later. So let me know if you see this, Thanks.
has scripting terminology
property isfalse
. Itsdisplayed name
property isQuick Look Helper
andidentifier
property iscom.apple.QuickLookDaemon
. I do not believe you'll be able to do much with it.