Script to copy fonts to User:Library:Fonts folder

Hey,

I’m trying to update my old script, but can’t figure it out. I want to copy fonts from a folder in Active window to “user/library/fonts” folder. The script is giving me error.

My script is this, can someone please help me out:

set userApplicationSupportFolder to path to application support folder from user domain as text
tell application "Finder"
	set theLocation to target of front window
	
	-- Copies the scripts to Desktop
	duplicate (folder "General_Scripts" of theLocation) to desktop with replacing
	
	-- Copies the PDF Preset to the Preset folder
	duplicate (every file of folder "PDF_Presets" of theLocation) to folder (userApplicationSupportFolder & "Adobe:Adobe PDF:Settings") with replacing
	
	-- Copies the Fonts to the User Fonts folder
	set myPath to (path to home folder as text) & "Library:Fonts" as alias
	duplicate (every file of folder "New Fonts" of theLocation) to folder (myPath) with replacing
	
end tell

What if you move the instruction :

   set myPath to (path to home folder as text) & "Library:Fonts" as alias

before the

tell application "Finder" 

one.

Yvan KOENIG running High Sierra 10.13.3 in French (VALLAURIS, France) mercredi 14 février 2018 16:18:21

Hi :slight_smile:

You can also use the following native path codes:


set system_fonts_path to path to fonts folder from system domain
set local_fonts_path to path to fonts folder from local domain
set user_fonts_path to path to fonts folder from user domain

return {system_fonts_path, local_fonts_path, user_fonts_path}

:slight_smile:

Thanks for the suggestions. It worked. :slight_smile: