View Single Post
Hi,

I would like to create a bash script with an enclosed applescript. I need that because I have a NAS and I want to share pdf versions with people. I edit every days dozens of .oo3 so It would be more convenient to be able to include that process within my rsync script. I've try to do that but I don't know how to solve the issues :
Code:
set myDoc to "/Users/Pamphile/Desktop/notes.oo3"
set pdfSavePath to "/Users/Pamphile/Desktop/"

tell application "OmniOutliner Professional"
	activate
	open myDoc
end tell

tell application "System Events"
	tell process "OmniOutliner pro"
		-- Press command+p to open our print dialog
		keystroke "p" using command down
		
		-- Let's make sure our print dialog is up
		repeat until exists window "Print"
		end repeat
		
		-- Click the PDF menu button
		click menu button "PDF" of window "Print"
		
		-- Make sure the menu is up
		repeat until exists menu item "Save as PDF…" of menu 1 of menu button "PDF" of window "Print"
		end repeat
		-- Select the "Save as PDF" menu item
		click menu item "Save as PDF…" of menu 1 of menu button "PDF" of window "Print"
		
		-- Make sure the save dialog is visible
		repeat until exists window "Save"
		end repeat
		
		-- Press command+shift+g to show the "Go" drop down sheet
		keystroke "g" using {command down, shift down}
		-- Set our location field to our pdfSavePath
		set value of text field 1 of sheet of window "Save" to pdfSavePath
		-- Now click the Go button
		click button "Go" of sheet of window "Save"
		
		-- Now that we are in our desired folder, set the file name and save
		set value of text field 1 of window "Save" to "Notes.pdf"
		
		click button "Save" of window "Save"
	end tell
end tell
Thanks for your help !!!!

Last edited by pamplemousseman; 2011-08-29 at 01:28 PM..