I have a folder on server with a sub folder of scripts and another sub folder containing PDF presets.
Every time I update the scripts/presets, I have to copy them in all the machines one by one, replacing the old ones.
I would like to achieve this using an AppleScript in the following way;
I’ll keep this AppleScript along with the sub folders on the server and when a user clicks on the script:
The scripts-folder will be copied on to his Desktop replacing the old one and;
the PDF Presets files needs to be copied to the location given below:
Macintosh HD:Library:Application Support:Adobe:Adobe PDF:Settings
I tried to achieve this, but failed:
tell application "Finder"
set userName to short user name of (system info)
set theLocation to (target of front window) as string
-- Copies the scripts to Desktop
copy (folder "General_Scripts" of folder theLocation) to desktop
-- Copies the PDF Preset to the Preset folder
set DestinationPresetFolder to alias (folder "Test" of folder "Adobe PDF" of folder "Adobe" of folder "Application Support" of folder Library of folder userName) as string
copy (every file of folder "PDF_Presets" of theLocation) to DestinationPresetFolder
end tell
However, the script is copying the General Scripts folder to the desktop successfully, but the latter part and the replacement is still missing in the script.
Any ideas…
I am about to find my way. I tried editing the script like this:
tell application "Finder"
set userName to short user name of (system info)
set theLocation to (target of front window) as string
-- Copies the scripts to Desktop
duplicate (folder "General_Scripts" of folder theLocation) to desktop with replacing
-- Copies the PDF Preset to the Preset folder
duplicate (every file of folder "PDF_Presets" of folder theLocation) to folder "Settings" of folder "Adobe PDF" of folder "Adobe" of folder "Application Support" of folder "Library" of folder userName of folder "Users" of startup disk with replacing
end tell
This has resolved my problem. But I’m still worry about the destination path for the PDF presets. It seems to be too long.
Moreover, can anyone suggest me how to create shortcuts in a Dock using the script.
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
end tell
I have tinkered with that, but it’s been a while, so I do not have a working solution at hand.
The script you linked to made my Mac unusable…
Some ‘reverse engineering’ is required. Start with some files & folders in your dock, then run this script:
set prefsFile to (((path to preferences from user domain) as text) & "com.apple.dock.plist") as alias as text
tell application "System Events"
set dockRec to value of property list file prefsFile -- everything
set others to |persistent-others| of dockRec -- files & folders
end tell
Others will contain the metadata for the files & folders in your dock, so you can work out what you need to add to that list.
(It’s actually a list of records, and the records contain records - easy to get lost)
I did have some links that should show you how to proceed:
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.
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 "Fonts_xyz" of theLocation) to folder (myPath) with replacing
end tell