• 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: Preview.app scriptable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preview.app scriptable


  • Subject: Re: Preview.app scriptable
  • From: Gmeiner Jobst <email@hidden>
  • Date: Wed, 13 Jan 2010 21:44:11 +0100

Hi Robert and Yvan,

thank you again for your mails. Now, I am totally confused and not amused!

As I reported before, the 'first window' didn't move at all when scripted. By accident then I adressed window 2, and voilĂ , it did what it should (using 'size' and 'position' as you suggested, 'bounds' are not working).

Then, I asked for the name of window 2 and got  the result I see on top of the window of the jpg-file on the screen:

tell application "System Events"
get name of window 2 of application process "Preview"
--> "1966_12_25_Michaelkalender.jpg"
end tell

Asking for the name of window 1 I got nothing:

tell application "System Events"
get name of window 1 of application process "Preview"
end tell

Then, I repeated everything from the scratch starting 'Preview' with double clicking a random jpg.-file  >> same result.
Then, I repeated everything from the scratch starting 'Preview' with double clicking a random jpg.-file  on my MacBook >> same result.

Therefore, when I use in the script the name of the window instead of the number, everything seems to be OK!

Could you tell me by chance what's all about the 'ghost' window 1 of Preview.app ?

Thanks for your patience 
Jobst

___________________________________

Jobst Gmeiner
email@hidden



Am 13.01.2010 um 18:56 schrieb Robert Poland:

Jobst,

I found that some applications do not accept bounds so I have to use size and position,

 I am using OS 10.6.2.

 
On Jan 13, 2010, at 10:13 AM, Gmeiner Jobst wrote:

Hi Robert,

thank you for your script. I tried already to script 'System events' but the 'first window' doesn't accept anything, size, bounds or position ?!
i.e.:

tell application "System Events" to set appList to name of application processes whose frontmost is true
set frontApp to item 1 of appList
tell application frontApp
set bounds of window 1 to {730, 1, 1630, 700}
end tell

the error: number -10006 from bounds of window 1

Is this behaviour specific for Snow Leopard?

Regards
Jobst

___________________________________

Jobst Gmeiner
email@hidden



Am 13.01.2010 um 15:23 schrieb Robert Poland:

Jobst,

Here's a small part of a script I use. Maybe you can adapt it to your use.

set newL to 20
set newT to 22
set wd to 800
set ht to 1000
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution") to set {newR, newB} to {word 2 as number, word 4 as number} -- get screen size for monitor

-- tell application "Finder" to set x to the displayed name of (path to frontmost application)
tell application "Finder" to set x to the displayed name of (path to application "Firefox")
if x contains "Firefox" then
set apli to "Firefox"
set rignewBoffset to 190 -- offset to the left for large screen
set newR to newR - (rignewBoffset) -- 1500
set newT to 22
if newR > 1440 then -- larger monitor
set newL to 593 - (rignewBoffset) -- 413
set newSize to newR - newL
else -- MBP
set newL to 280
set newSize to newR - newL
end if
end if
tell application "System Events" to tell application process apli
tell first window
set size to {newSize, newB}
set position to {newL, newT}
--click button 2
end tell
set frontmost to true
end tell
beep
return



On Jan 13, 2010, at 6:03 AM, Gmeiner Jobst wrote:

Hi everybody,

with OSX 10.5.8 I used the following script (which I had found somewhere in the internet)

try
tell application "Finder"
set the Preview_app to (application file id "com.apple.Preview") as alias
end tell
set the plist_filepath to the quoted form of ((POSIX path of the Preview_app) & "Contents/Info")
do shell script "defaults write " & the plist_filepath & space & "NSAppleScriptEnabled -bool YES"
end try

in order to make Preview.app scriptable. The reason was that I wanted to get the windows of Preview.app to a defined position on my screen with scripting.

Now, having moved to Snow Leopard, the script above doesn't work anymore, Preview.app is no longer scriptable.

Is there another possibility, either acchieving scripting Preview.app or using another programm which can open .jpg files and is scriptable,
in order to put the pictures to a defined position on the screen?

Thanks for suggestions
Jobst Gmeiner

___________________________________

Jobst Gmeiner
email@hidden



Bob Poland - Fort Collins, CO


Bob Poland - Fort Collins, CO




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Preview.app scriptable
      • From: Axel Luttgens <email@hidden>
    • Re: Preview.app scriptable
      • From: Yvan KOENIG <email@hidden>
    • Re: Preview.app scriptable
      • From: Robert Poland <email@hidden>
References: 
 >Preview.app scriptable (From: Gmeiner Jobst <email@hidden>)
 >Re: Preview.app scriptable (From: Robert Poland <email@hidden>)
 >Re: Preview.app scriptable (From: Gmeiner Jobst <email@hidden>)
 >Re: Preview.app scriptable (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Preview.app scriptable
  • Next by Date: Re: Preview.app scriptable
  • Previous by thread: Re: Preview.app scriptable
  • Next by thread: Re: Preview.app scriptable
  • Index(es):
    • Date
    • Thread