Re: Exporting pdf to jpeg using preview
Re: Exporting pdf to jpeg using preview
- Subject: Re: Exporting pdf to jpeg using preview
- From: Dave Stewart <email@hidden>
- Date: Thu, 11 Nov 2004 11:01:53 -0800
On Nov 11, 2004, at 10:38 AM, Bernardo Hoehl pondered:
Hi Dave,
tell application "System Events"
keystroke "e" using {command down, control down}
end tell
Do I have to activate UI Scripting on Systems Preferences for this to work?
Yup, GUI scripting won't work at all unless you activate the "Enable access for assistive devices" checkbox in System Preferences -> Universal Access pane.
Oh, you know what it may want? I hadn't thought of this before (I don't do enough scripting to be really good at this:), but it probably wants something similar to this:
========== BEGIN UNTESTED CODE THOUGHT ==========
tell application "System Events"
tell application process "Preview"
keystroke "e" with {command down, control down}
end tell --process "Preview"
end tell --"System Events"
========== END UNTESTED CODE THOUGHT ==========
I remember having to jump through these hoops when scripting Terminal.app.
If you have Neuberg's "AppleScript: The Definitive Guide", you'll find GUI stuff starting around page 358. If you don't have this book yet, I'd highly recommend it if you plan on writing any other AppleScripts. It does a good job of removing the darkness and mystery from AS.
;-)
You might want to take a look at PreFab's UIBrowser ...
<http://www.prefab.com/uibrowser/>
I can't imagine developing GUI scripts without it, it's a pretty slick tool. And if you run into trouble, you can find it's author Bill Cheeseman here on this very list to help out. Although I've never needed to bug him myself (OK, maybe once:), if UI Browser can't handle it that usually means it's not possible and I just give up and look for another answer.
It doens't seem to work for me in any way. activated or not.
I always hear just a beep, as if I hit the wrong key on the keyboard.
Thanks
Anytime! HTH!
Bernardo
======================
On 11 Nov, 2004, at 4:08 PM, Dave Stewart wrote:
Gee, something I can answer! ;-)
On Nov 11, 2004, at 9:29 AM, Bernardo Hoehl pondered:
Hi Folks,
I am trying to create a script for my wife, to export her screenshots from pdf to jpg.
Her customers are PC users and might not see the pdf files in case they don't Acrobat Reader installed.
Using jpg would be a wise precaution.
But I am stuck trying to figure out how to get System Events to press 3 keys simultaneously....
This is the code so far: (may be I make it a droplet later...)
tell application "Preview"
set x to choose file
activate
do shell script "open " & quoted form of POSIX path of x
delay 3
tell application "System Events"
keystroke "e" using command down --using control down
end tell
end tell
Thanks for any help,
Bernardo Höhl
Rio de Janeiro - Brazil
Sorry if I'm late to the party, I'm on digest mode and just now saw this. I think what you're looking for is this:
tell application "System Events"
keystroke "e" using {command down, control down}
end tell
Examples to model from can be found at Apple's site:
GUI scripting:
<http://www.apple.com/applescript/uiscripting/>
Examples:
<http://www.apple.com/applescript/uiscripting/03.html>
HTH!
Dave Stewart
Aqua~Flo Supply (Goleta CA)
dstewart at aquaflo dot com
The human mind ordinarily operates at only ten percent of its
capacity -- the rest is overhead for the operating system.
Dave Stewart
Aqua~Flo Supply (Goleta CA)
dstewart at aquaflo dot com
Vincent van Gogh visits his psychiatrist, a bloodstained bandage draped around his ear (or rather, the ear that was). Dutifully, he lies down on
the couch, his face serene, despite his physical pain. The doctor is agitated and nonplussed. When he finds the words, he shakes his head slowly:
"No, no, no, Vincent. I said, take a year off."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden