Get relative alias to a folder in applications folder?

Hi I’m trying to get applescript to get the alias to a folder within the applications folder, without using a strict path.

I know the folder’s name “Make a Delivery” so when I use the applescript below, the result I get is: “Macintosh HD:Applications:Make a Delivery”

on run {input, parameters}

tell application "System Events" to path of applications folder & "Make a Delivery"
return result

end run

But for some reason Automator seems to require the result look like: {alias “Macintosh HD:Applications:Make a Delivery:”} in order to perform actions like “Get Folder Contents, etc”.

Any ideas are greatly appreciated. I’m doing this to try and improve a freeware app called Make a Delivery. Spanks!

Knowing nothing about Automator, but something about AppleScript, it should say:

on run
	tell application "Finder" to set p to (path to applications folder as text) & "Make a Delivery"
	return p
end run

– remember that p is a folder. Automator seems to translate that to the right address for me - I can get the Finder to open the folder.

This script returns the same result: “Macintosh HD:Applications:Make a Delivery”

Which for some reason doesn’t get passed in a way where Automator actions such as “Get Folder Contents” or “Open Finder Items” will work.

Automator seems to require {alias “Macintosh HD:Applications:Make a Delivery:”} in order to perform actions on the folder such as “Get Folder Contents”.

How does one go about learning Applescript? So far I’m no good for more than begging for divine macscripter knowledge, and attempting novice remixes = ) Which is fun btw

I started 14 months ago by buying the e-version of Danny Goodman’s book and then bought several others as I began to understand what was going on from this excellent list.

I haunted this board, lurked on the AppleScript Users List applescript-users@lists.apple.com and read what they were discussing (but at a fairly high level), followed the discussions.apple.com forum on AppleScript, and a few others and collected snippets for doing things from all of them, and organized them into folders. Google is your friend too, as are the searches provided by the various boards. I downloaded interesting looking scripts from ScriptBuilders (that were not run-only) and looked at how they did stuff. I asked a thousand questions.

I think (having looked at your Automator App) that you could do all of that in AppleScript and then use XCode to turn it into an app with a GUI if you wanted to, but certainly you could do all that you want to do in a plain vanilla AppleScript.

Hi,

I don’t have automator, but this might help. This:

tell application “System Events” to (“” & (path to applications folder) & “Make a Delivery”) as alias
return result

should return a string. It’s not a reference. To make it a reference, coerce the string to alias reference.

tell application “System Events” to (“” & (path to “apps”) & “Make a Delivery”) as alias
return result

Note: when coercing to alias reference, if the item doesn’t exist, then an error occurs.

gl,

Just a bit of pedantry about ‘path to’. Firstly, it’s in the StandardAdditions, so no ‘tell’ block’s required. Secondly, it has an ‘as’ parameter, which is very slightly faster than a coercion:

(path to applications folder as text)
--> 'path to' returns text.

(path to applications folder) as text
--> 'path to' returns an alias, which AppleScript then coerces to text.

"" & (path to applications folder)
--> 'path to' returns an alias, which AppleScript coerces to text in order that it may then be concatenated to "".

My own suggestions for the result audiowizard seems to need would be:

return ((path to applications folder as Unicode text) & "Make a Delivery:") as alias as list

-- Or:
return {((path to applications folder as Unicode text) & "Make a Delivery:") as alias}

Hi Nigel,

Thanks for reminding me about the ‘as’ parameter. I have a brain lock with closing the parenthesis after the direct parameter.

gl,