Thursday, December 14, 2017

#1 2017-11-29 10:52:53 pm

ddinisco
Member
Registered: 2008-04-05
Posts: 27

Quicklook resize window

Is there a way to reszie and reposition a quick look window with an apple script? I have an apple script that will do this with any app, but I do not know what the QL app is called. I tried, QuickLook, Quick Look and QL.

Applescript:

set theApp to "Finder"
set appHeight to 100
set appWidth to 1920

tell application "Finder"
   set screenResolution to bounds of window of desktop
end tell

set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution

tell application theApp
   activate
   reopen
   set yAxis to (screenHeight - appHeight) / 2 as integer
   set xAxis to (screenWidth - appWidth) / 2 as integer
   set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
end tell

Last edited by ddinisco (2017-11-29 10:56:21 pm)

Offline

 

#2 2017-11-30 06:15:12 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4453

Re: Quicklook resize window

Hi.

Quick Look windows aren't covered by the Finder's AppleScript implementation. But assuming you have one open, it can be positioned using GUI Scripting — provided you have that enabled on your machine:

Applescript:

set theApp to "Finder"
set appHeight to 100
set appWidth to 1920

tell application "Finder"
   set screenResolution to bounds of window of desktop
end tell

set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution

tell application "System Events"
   tell application process theApp
       set frontmost to true
       set yAxis to (screenHeight - appHeight) / 2 as integer
       set xAxis to (screenWidth - appWidth) / 2 as integer
       set the position of the first window to {xAxis, yAxis}
       set the size of the first window to {appWidth, appHeight}
   end tell
end tell


NG

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)