Create the invisible Icon^M File with applescript

my goal is to create a folder custom icon via applescript

in the terminal it’s simple

touch Icon ctrl V ctrl M
/Developer/Tools/SetFile -a V Icon*
cp imagefilewiththecustomicon/rsrc Icon^M/rsrc

but my problem in applescript is to be abble to create this F@&#$ file Icon^M which has a special caracter at the end (created in the terminal with the key combination ctrl V ctrl M)…

is there anybody who knows how to specify this terrible name in an APPLESCRIPT script???


do shell script "cp imagefilewiththecustomicon/rsrc Icon" & return & "/rsrc"

The Control-M is just an octal 15/Ascii 13, AKA, “return”. The control-v is an oct 26/ascii 22.

you can use the “ASCII character” command to concatenate these to your file name.

Here’s a “Control code to ascii” Google for your reference…

You can also just use “do shell script” and use the shell script.

Then how would I attach the IconFile

tell application "Finder" to set IconFile to (name of startup disk & "") as string

to a specific folder on the desktop ?