Relative Paths in Automator?

Hi–

New to Automator. Kinda familiar with AppleScript. What I’m trying to do is setup an Automator Workflow Application that installs some fonts via fontbook on a user’s machine. I’ve got a workflow that does this quite nicely, but the path to the font files to install is hardcoded.

I would like to put the files in /Library/Application Support/, then install them, and then trash the source files. This all works great on my machine. As soon as I take it somewhere else, the workflow doesn’t work. I’ve only got the default actions, I haven’t tried to write my own Automator Action yet.

Thanks for any help

Allen

Hello ajfisher,
If I am understanding what you want to do correctly, the Fonts should be placed into the /Users/TheUserName/Library/Application Support/ folder. Then they are installed into Font Book.

You could place a Run AppleScript Action in your Workflow and place this code into it to get access to the current users /Library/Application Support/ folder


on run {input, parameters}
	
	set theUserApplicationSupportFolder to path to application support from user domain
	
	return theUserApplicationSupportFolder
end run

This returns an alias to the Application Support folder of the user running the script

If you want access to the Font folders on their system you could use these as well


set theUserFontFolder to path to fonts from user domain
set theSystemFontFolder to path to fonts from system domain

jON bEEBE

I have a similar hurdle that I would like to overcome. I’ll give a detailed description of what I’m trying to do just so I can get a more refined answer, so sorry if this is long.

I have a package inside of the ~/Library/Application Support/Rapidweaver folder that I would need to do some file copy and pasting inside this package. I need to move ~/Library/Application Support/Rapidweaver/Modified Nautica.rwtheme/contents/modified/theme1.plist over to root of the package (~/Library/Application Support/Rapidweaver/Modified Nautica.rwtheme/contents/) Of course as shown all files needed for this are contained inside the package, but of course I would like to distribute this workflow/app after completion and cannot accomplish this without relative paths. Once that is complete a user will be inserting an image into this package through the “Ask for Finder item” action and then again would need to be copied to the relative pathway inside of the package(~/Library/Application Support/Rapidweaver/Modified Nautica.rwtheme/contents/images/). Any thought? If anyone would like an in depth look at exactly what I would like to accomplish I have put the file on my server here (8kb). It is a complete working workflow but only on my computer.Thanks in advance for the help.

dary23

I’ve been wondering the same for a long time.
But after some simple logic testing, I figured it out! :smiley:

Let’s say I have this folder called images on my desktop, and I want to relatively place that path into the next action.


on run {input, parameters}
	set input to path to desktop from user domain
	set input to input & "images"
	set input to input as text
	set input to alias input
	return input
end run

I can’t find any simpler way to put it.