Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 19, 2011, 10:12 AM   #1
jabberwooky
macrumors newbie
 
Join Date: May 2009
Help tweaking applescript in service workflow

Would love any help with this to improve my workflow:

I found an applescript online that I have used to build a service within automator. It allows me to right click on a .pages document and convert it to pdf. Currently though, the naming of the file isn't working quite as I expected:

Example.pages
[right click, run pages2pdf service]
(output-->) Example.pagesExample.pdf

Here is the applescript:

Code:
on run {input, parameters}
	
	-- based on code from http://pagesfaq.blogspot.com/2006/11/i-have-one-thousand-pages-documents-to.html
	
	--on open theFiles
	set outputFiles to {}
	set theFiles to input
	
	tell application "Pages"
		repeat with aFile in theFiles
			open aFile
			set docName to name of front document
			set docPath to path of front document
			-- Remove .pages extension.
			set prevTIDs to AppleScript's text item delimiters
			set AppleScript's text item delimiters to ".pages"
			-- Add .doc extension.
			set docName to first text item of docName
			set AppleScript's text item delimiters to prevTIDs
			-- Save file in same folder
			set docPathAndName to docPath & docName
			save front document as "SLDocumentTypePDF" in docPathAndName
			close front document
			set end of outputFiles to docPathAndName & ".pdf"
		end repeat
	end tell
	--end open
	
	
	return outputFiles
end run
Any tips, suggestions, answers?

(running OS X 10.6.7)
jabberwooky is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Looking for a specific idea for help in my workflow .... eroxx Mac OS X 0 May 7, 2011 10:23 AM
Handling Duplicate AppleScripts the Otter Mac Programming 1 Dec 22, 2010 05:53 AM
help with excel for mac 2008 damiang72 Mac Applications and Mac App Store 0 Nov 14, 2010 06:19 AM
applescript - launch workflow after cottonn Mac Programming 0 Mar 7, 2010 08:43 AM
Help tweaking a setting in Thunderbird mail client Kevster89 Mac Applications and Mac App Store 5 Apr 1, 2009 05:36 PM


All times are GMT -5. The time now is 08:25 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC