The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Today's Posts

 
Exportation in pdf with an applescript Thread Tools Search this Thread Display Modes
You can do it all directly from the shell:

Code:
osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1
/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o output2.pdf > /dev/null 2>&1
 
Ok thanks but how can I specify witch folder I want to use and where I want to save it ?

Quote:
Originally Posted by RobTrew View Post
You can do it all directly from the shell:

Code:
osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1
/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o output2.pdf > /dev/null 2>&1
 
Right there in the command line you supply:

Code:
osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1
/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o output2.pdf > /dev/null 2>&1
the "-o output2.pdf" portion of the convert command tells it to write the output to a file named "output2.pdf" in the current directory. If you want to put it in the directory called "Example" in your home directory, that would be "-o ~/Example/output2.pdf" and so on. Rob's illustrative snippet illustrates the process of building up that command string. To save you the trouble of copying the file to the NAS volume and then deleting the local copy, you could write it directly to the NAS volume. All of this supposes that you've already figured out what the name of the file is going to be, of course...
 
Ok thanks but I way talking about the input directory, how to set it ?
I have a folder with subfolder, the input would be the main folder. Every day there is change with all the .oo3, every day I launch a bash script who save all data to the has. To the has I want the .oo3 and the .pdf. So within the bash script I would like to add an applescript which gonna use the main folder and convert all the file in .pdf and move them to the has. So here in the script I don't know how to change the input, front document.

Quote:
Originally Posted by whpalmer4 View Post
Right there in the command line you supply:

Code:
osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1
/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o output2.pdf > /dev/null 2>&1
the "-o output2.pdf" portion of the convert command tells it to write the output to a file named "output2.pdf" in the current directory. If you want to put it in the directory called "Example" in your home directory, that would be "-o ~/Example/output2.pdf" and so on. Rob's illustrative snippet illustrates the process of building up that command string. To save you the trouble of copying the file to the NAS volume and then deleting the local copy, you could write it directly to the NAS volume. All of this supposes that you've already figured out what the name of the file is going to be, of course...
 
It sounds like you want something like the following. Once you have all the documents open, this will cycle through them and execute the code in the inner section for each. Hope this helps!

Code:
tell application "OmniOutliner Professional"
	repeat with aDocument in every document

		-- e.g. the stuff you want to do goes here 
		set text of cell 2 of row 1 of aDocument to "hello"

	end repeat
end tell
 
Thanks, but can I do the same without opening anything ?

Quote:
Originally Posted by Brian View Post
It sounds like you want something like the following. Once you have all the documents open, this will cycle through them and execute the code in the inner section for each. Hope this helps!

Code:
tell application "OmniOutliner Professional"
	repeat with aDocument in every document

		-- e.g. the stuff you want to do goes here 
		set text of cell 2 of row 1 of aDocument to "hello"

	end repeat
end tell
 
You can get the file name from the shell process which loops through the .003 files.

If you can make sure that all documents in oo3 are closed, you can then assume that the newly opened one is the front document.

Don't have time for testing or debugging today, but you should be able to put something along these general lines in a shell script:

Code:
osascript -e 'tell application id "OOut" to close documents' > /dev/null 2>&1;
for f in *.oo3 
do 
	open "$f"
	sleep .5 # You may be able to reduce or remove this
	osascript -e 'tell application id "OOut" to export front document as "OORTFPboardType" to "~/tmp.rtf"' > /dev/null 2>&1;
	/System/Library/Printers/Libraries/convert -f  ~/tmp.rtf -o "$f".pdf > /dev/null 2>&1;
	osascript -e 'tell application id "OOut" to close documents' > /dev/null 2>&1;
done
rm ~/tmp.rtf

Last edited by RobTrew; 2011-08-31 at 03:39 AM..
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
XML and AppleScript seanprice OmniFocus Extras 0 2013-03-14 01:07 PM
Applescript help mojaverat OmniFocus 1 for Mac 1 2011-08-23 03:18 PM
Applescript? dbadev OmniDazzle 0 2011-06-22 05:46 PM
Applescript Help ryan_marsh OmniFocus 1 for Mac 3 2008-11-24 08:51 AM
Applescript, run from USB jem OmniFocus 1 for Mac 4 2007-05-22 02:09 AM


All times are GMT -8. The time now is 12:08 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.