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 > OmniPlan > OmniPlan General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Omniplan 2.3 incompatible with Mountain Lion? Thread Tools Search this Thread Display Modes
Or the other way around...

All my export tasks (except for manually choosing Export in the File menu) have stopped working as of the upgrade from the App Store.

I can't even automate exporting through Applescript:


tell application "OmniPlan"
my exporttoPdf(front document)
end tell

on exporttoPdf(doc)
tell application "OmniPlan"
set theFile to (file of doc) as string
-- remove extension and directory separator and append .pdf instead
set theFile to ((characters 1 thru -7 of theFile) as string) & ".pdf"
set theFile to "Macintosh HD:Users:myname:Desktop:xxx.pdf"
export doc to theFile as "PDF"
end tell
end exporttoPdf

I get a xxx.pdf cannot be moved since you don't have permission to access "Desktop". Same if I execute the applescript from within the publishing task.
 
Sorry, this is a sandboxing issue. I wish we could continue to execute your old scripts without warning, but Apple has decided that letting us write file output to an arbitrary location endangers you, the user. Once we are handling an Apple event there is really know way for the system to be sure that you, the user, had any part in authorizing that event. It's all a bit baffling, but somehow if you face east and wave your hands in the air, it suddenly becomes ok to use POSIX files in the exact same way, for example:

tell application "OmniPlan"
tell front document
export to POSIX file "/tmp/foo.pdf" as "PDF"
end tell
end tell

I'm honestly quite clumsy with AppleScript and gave up after 60 seconds of trying to refactor your exporttoPdf() function, but speak up if you have trouble getting POSIX file to work.

-Tom
 
Wonderful and very weird. Surely that must be a bug in the sandboxing implementation. I hope Apple doesn't find out and plug that hole in Mavericks.

Now my publishing works again! Yohoo!
Here's the script that I now got to work as an Applescript publishing step.
I'm sure it could be improved to grab the "current document" from the publishing context but I don't know how that's done.

Code:
tell application "OmniPlan"
	my exporttoPdf(front document)
end tell

on exporttoPdf(doc)
	tell application "OmniPlan"
		set theFile to (file of doc) as string
		-- remove extension and directory separator and append .pdf instead
		set theFile to ((characters 1 thru -7 of theFile) as string) & ".pdf"
		set theFile to POSIX path of theFile
		-- for unknown reasons, export from the sandbox only works with POSIX files
		export doc to POSIX file theFile as "PDF"
	end tell
end exporttoPdf
 
Unfortunately after upgrading to Mavericks this no longer works...

I get a
"xxx" couldn't be removed because you don't have permission to access it.
 
Oh, well, that's just great, isn't it? I'll look into that. It sounds like it's working exactly as Apple intends, which is not very helpful. If so, the only thing I can think of that might work is to have the script prompt for the file, which is not something I've tested in conjunction with automated publishing:

set theFile to choose file name with prompt "Save PDF as:"
of type {"adobe.pdf"}
default name "defaultFilename"
default location somePlace

-Tom
 
Oh I so regret purchasing Omniplan through the App Store.

I suggest you remove the app from there or continue to request sandbox exemption until Apple has sorted out how to make applications work with trivial Applescript use cases such as mine.
 
You know, I hadn't fully absorbed that your real goal here (if I've interpreted this correctly) is simply to export a PDF as part of Pub/Sub. We did have an issue that permission to write to the export location would be lost due to sandboxing. When we fixed that, Mavericks promptly broke that approach. But we fixed it again, and this time I think it will stick!

Can you just go back to a run of the mill Export PDF action at this point? Very sorry for the inconvenience. I have faith that in the long run sandboxing will be a win for the users, but there have definitely been a few bumps in the road.

-Tom
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 12:18 PM.


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