I want to open a pdf in preview and shift command 4 a couple times with the out put file with the name of the pdf I am looking at (with Page #) in preview.
Now why would Apple make preview unscriptable, It is just GOOFY!!!
I’m not sure I understand your needs, but perhaps the one called “sfri printToDesktop” within sfriTools can help you.
http://homepage.mac.com/julifos/soft/sfritools/index.html
It uses UI Scripting to print a PDF from the frontmost web page in Safari (it needs a easy installation)
thank You for your time but nope that wont do it.
doing a shift command 4 and selecting a certain part of a multi page pdf and saving it as (page 2 a, page 2 b ,page 2 c and then moving to the next page, the crop tool works in acrobat cs but acrobat is one of them unscriptable apps If I am correct.
I found a nice start with this
but (arg ) Information overload
and this from a reply
UI Browser is a tool that helps you to design AppleScript scripts. UI
Browser can certainly help you to figure out whether an AppleScript script
can be written to do what you ask, and it can help you to write such a
script if it can be done. UI Browser can even generate helpful AppleScript
code statements using “GUI Scripting,” a new AppleScript technology that
Apple introduced in Mac OS X 10.3 Panther to allow you to script
non-scriptable applications by scripting their user interface elements, such
as menu items and buttons.
But UI Browser does not actually perform automated tasks for you. It is only
a script writer’s utility.
I have spent a few minutes exploring some, but not all, of the steps that
would be required by your project.
-
GUI Scripting (and UI Browser) can read the value of the page number
field in Preview, so it would be easy to write a script to get the page
number and use it to compose a file name unique to that page. -
GUI Scripting (and UI Browser) can click the Page Down button in Preview,
so it would be easy to write a script to move on to the next page
automatically. -
As far as I know, GUI Scripting is not able to trigger the
Shift-Command-4 key combination, because that is a system keyboard shortcut,
not an application-specific shortcut.
It might be possible to capture the screen using a Unix shell script, but I
don’t know. Shell scripts can be executed via AppleScript in Mac OS X.
If a shell script will not work, you would have to include a screen capture
utility in your workflow. I don’t know whether there are any screen capture
utilities available that are directly scriptable – if there are, you can
probably find them on Google, and if such a utility exists it would
certainly be the best way to handle your project. I am told that
CESoftware’s QuicKeys utility can do this, and it is certainly scriptable.
Of course, it is a commercial product.
As to free screen capture utilities, I can only point you to Apple’s Grab
application, which is installed as part of Mac OS X. While it is not
scriptable itself, AppleScript can partially control it using GUI Scripting.
Below is a simple example of how to use AppleScript to capture an image of a
window using GUI Scripting.
tell application “Grab”
activate
tell application “System Events”
tell process “Grab”
tell menu bar 1
click menu item “Window” of menu “Capture”
end tell
end tell
end tell
end tell
After running this script, you will see an alert on your screen telling you
to click the window you want to capture. You can click the Preview window
manually, of course. It might also be possible to do it via AppleScript,
using GUI Scripting’s ‘click at’ command and a parameter giving the
coordinates of a point on the screen within the Preview window. But I
haven’t tried it, so I don’t know whether it will work.
- The other tasks you want performed – creating a specific file name for
the captured screenshot, and saving it – can probably all be done using GUI
Scripting, and UI Browser is a helpful tool to figure out how to do that.
I’m sorry, but we can’t actually write the script for you. Using AppleScript
to automate your workflow will require an intermediate to advanced knowledge
of AppleScript, so you might need a consultant.
I hope this is helpful.
–
Bill Cheeseman - wjcheeseman@prefab.com
PreFab Software, Inc. - www.prefab.com/uibrowser/
p.s. THANKS Bill
an F key can be set to key groupings correct?? Say F1 = shift command 4
browsing a pdf in preview and hitting F1 will produce a bunch of files on the desktop named picture 1 ect.
now If I am correct jon8 wrote a script to remane them and organize GREAT half way there.
say the pdf I am browsing is 20 pages and I am on page 2 and the name is abcd.
now is there a way to get the output file name upon the F1 to be in succesion and call the the page number?
resulting in around 100 pages all titled
abcd page 2a
abcd page 2b
abcd page 3a
ect??
Here’s a script that will do what you want as long as GUI scripting is enabled. Open the PDF in preview and make sure you are on the first page. It will then make a new folder on your desktop (if it doesn’t already exist) named for the PDF. Then it will enter interactive screen capture mode. Once you select your area it will ask you if you want to capture another on the current page or move to the next page until all the pages have been covered. It will save the captured PDFs with the title, page, and iterative letter. This was tested on Mac OS X 10.3.3 but should be fine on earlier systems as long as GUI scripting is enabled. I would normally charge for a script like this…
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
AWESOME WORK
Jon
I dont know what to say other than its AWESOME