move file but only a copy of it

Hi, hope someone can help with this, I am trying to make a sctrip to check for a font, if the font is not installed. The script will install it. here is my script:

set x to path to me
set Fonts_to_check to {"geneva", "helvetica", "times"}
repeat with i from 1 to count of Fonts_to_check
	set thefont to item i of Fonts_to_check
	tell application "Finder"
		set fontspath to path to the fonts folder as alias
		set fontspathfull to fontspath & thefont as text
		if exists file fontspathfull then
			-- we do nothing!
			-- we put file in folder
			set thepath to x & "xxxx:xxxx:xxxxx:" & thefont as text
			move file thepath to fontspath
		end if
	end tell
end repeat

This works fine, but I dont whant to move my original file to the destination, i what a copy of my file to be moves. any idea on how to do this?

hep some one can help!


Check out Finder’s duplicate command:


And when you are done duplicating the font file to where you want it. Then you can

tell application "Font Book" to add file "hfs:path" to font container "the one that is fit"

I think that should go, so you don’t have to click on the font file or anything to install it. :slight_smile:

thank you both! :slight_smile:

I’ve written my own font manager/activator and checking for existence in a single folder isn’t really save. For instance some applications installs fonts in the local domain font folder while the other installs fonts in the user folder. Also there are system fonts why are installed in the system domain font folder. Then for developers there is a way activating a font on the fly (which is done by software like suitcase, universal type and font agent) no matter it’s location. So even checking those three folders isn’t a guarantee that the font isn’t activated already and could cause an font conflict.

Here a script version that does the check in system, local and user domain and copies when it doesn’t exists to the user’s font folder.

set requiredFonts to {"geneva", "helvetica", "times"}
set loadedFonts to {}
set loadedFonts to loadedFonts & getFileNames(POSIX path of (path to fonts folder from system domain))
set loadedFonts to loadedFonts & getFileNames(POSIX path of (path to fonts folder from local domain))
set loadedFonts to loadedFonts & getFileNames(POSIX path of (path to fonts folder from user domain))

repeat with requiredFont in requiredFonts
	if contents of requiredFont is not in loadedFonts then
		set pathToFontToCopy to quoted form of "/xxx/xxxx/xxxx/" & requiredFont & ".otf"
		do shell script "ditto -rsrc " & pathToFontToCopy & space & quoted form of (POSIX path of (path to fonts folder from user domain as text) & requiredFont & ".otf")
	end if
end repeat

on getFileNames(p)
	every paragraph of (do shell script "ls " & quoted form of p & " | sed 's/\\.[^.]*$//'")
end getFileNames

Hmm! :slight_smile:

You are really saying that dropping the font in one of those folders are enough to activate it?

That is both cool and Enlightening! I also see that you only use otf fonts! I think I use ttf as well for X11. (Something called dfont too, it seems.)

By the way; speaking of fonts, there may still be possible to get this tinkered Monaco 11 font, that used to come with programmers workbench from some ftp server at apple, (I have lost the address).

Adobe has recently made a very good open source font named Source Sans Pro, it comes in two versions, one monospaced, and one not.


I have a large collection of type 1 fonts from Adobe for the Ms Windows platform, are there any chance that I can use those on my Mac, maybe convert them?

(Good to know if I can just get rid of some garbage here. :slight_smile: )


A quick google showed me that I may be able to convert them, but I think I just can get rid of them, as there are indeed some large repositiories with free open type fonts out there.

This explains why we’ve chosen to get rid of all font differences and choose to use OTF as our only font type. We’ve used them all the past.

dfont is Apple’s font type but, i don’t know if you rember, in the Mac OS era files (and programs) kept their resources seperate from their data. Today, Mac OS X, the resource forks of files are almost alway empty. To fit in, Apple created a font type the same as used in Mac OS but only the resources fork is stored in the data fork.

Since Mac OS X 10.4 Apple started to support OTF fonts more and more and since then the dfont starts to disappear. My mountain lion machine uses dfont only for system and iLife all other is true typ, true type collection or open type font. It’s unclear to me why Apple keeps using the old dfont, maybe it’s old code.

The reason why we stopped with using Adobe Type * and started using otf is pretty well described here. As you can see the Adobe Type fonts didn’t support unicode while otf. does. The main reason why we converted our LinoType Gold CD (Adobe type fonts) into otf font files. And after all the fonts itself were easier to modify and manage than the old format.


Thanks for the answer. Now, My fonts are too old for Utf8, but I like to use Latex, Latex is per se using 7 bit ascii, they render pdf, so it is dubious whether I can hack this or not, but if they use some old method of relating fonts to glyphs, then I may be good with my old fonts.

I own a copy of MsOffice, so i have most of the fonts I need. It was just inconvenient thinking that I would throw out something I could have used. I own a copy of Aldus Pagemaker, and it was a gazillion of fonts with it, sometimes, it is ok to have a lot of fonts! :slight_smile:

X11 also uses ttf fonts, so there may be a possiblity of putting them to use. Not that I use X11 that much nowadays. But, there are tools there that are interesting, beyond their existance!

And. I think I’ll upgrade to Mountain Lion as well, while I can reckognize it. It is not sound to fall to many versions behind. :slight_smile:

all solutions are perfect and they work very nice, but i solved my problem with the duplicate finder command! thank you al! :slight_smile: