HAL-9000 Voice
I was looking for a voice to get for my computer similar to HAL-9000 from Space Odyssey. You'd figure with this being one of Apple's older ads, they would have included it.
http://www.youtube.com/watch?v=nHJkAYdT7qo
Anyway, does anyone know where I could get such a voice?
My guess is it's rather involved.
If you have the Xcode Developer tools installed, there are a couple of apps provided in /Developer/Applications/Utilities/Speech/:
Repeat After Me.app (and a brief User's Guide)
SRLanguageModeler.app
Similar Messages
-
Problem with existing script, can't get text of item
I'm taking an earlier script and condensing it so that it will only work from one SELECTED folder. I thought it would be simple but i seam to be running into a few issues
This is the error I get
Result:
error "Can’t get last text item of alias \"Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:\"." number -1728 from last text item of alias "Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:"
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
--Below is what I removed
--set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
--set tc to (count dtF)
--repeat with i from 1 to tc
-- set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
-- if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does --not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not
--start with "Sue" and folderName does not start with "Design" then
--Setup list of folders and process details of folders
tell application "Finder" to set folderName to (choose folder with prompt "Select Folder")
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow. F R E E D O M W I T H P N G
if brandName is equal to "Freedom" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- F R E E D O M Folder Photoshop Process W I T H P N G
set thisName to (item j of o's theseNames)
tell application "Finder"
set t_ext to name extension of file thefile
if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
set b to exists file (localBrandFolder_PSD & thisName & ".psd")
end tell
if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPNGOptions to {class:PNG save options, interlaced:false}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--Prepare for Low RES by resetting image history
set current history state to history state 3
delete current layer
merge visible layers
resize image width 1020
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (networkBrandFolder_Low_Res & name) as PNG with options myPNGOptions without copying
flatten
save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
else
save in (website_images & name) as JPEG with options myOptions without copying
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if
end repeat
--End F R E E D O M W I T H P N G
end if
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tellI'm getting close or at least I hope this is how it looks now, but appears not pick up the files in the folder?
The result
exists folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
get folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
get name of every file of alias (alias "Images:2012-2013:WK20:Freedom:Freedom_WK20_PSD:") whose {"8BPS"} contains file type or {"psd"} contains name extension
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tell
--------------------MAIN SCRIPT BELOW__------------------
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
--Setup list of folders and process details of folders
tell application "Finder"
set theFolder to (choose folder with prompt "Select Folder")
set folderName to name of theFolder
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "BHS" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H S Folder Photoshop Process
set thisName to (item j of o's theseNames)
tell application "Finder"
set t_ext to name extension of file thefile
if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
set b to exists file (localBrandFolder_PSD & thisName & ".psd")
end tell
if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if
end repeat
--End BHS
--taking the folder identify which process it must follow. B U R T O N
else if brandName is equal to "Burton" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B U R T O N Folder Photoshop Process
set thisName to (item j of o's theseNames)
tell application "Finder"
set t_ext to name extension of file thefile
if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
set b to exists file (localBrandFolder_PSD & thisName & ".psd")
end tell
if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1020
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to -
Dialog prompt and check if file exists, and use the result of dialog
I have this working script and I want to change the way it behaves.
I want a dialog to come up, Do you want to skip or replace existing files.
Then the result of the dialog to be used in the reast of the script.
I've added it in the script where I need to use it. in noce big letters, hopefully its not a big job.
Many thanks
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
--if thefile exists in the folder localBrandFolder_PSD then do the result of dialog.
--"Skip" the file and move on to next
--If "replace" continue the rest of the script.
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end repeat
--End BH
-- else if and the rest of the script.....
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tellHi,
I think that's what you want.
I put the dialog in the beginning, so it does not appear to each folder, otherwise put it in the loop as it was originally.
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
tell application "Finder" to set b to exists file (localBrandFolder_PSD & item j of o's theseNames)
if b and not skipFiles then -- file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if -- else "Skip" the file and move on to next
end repeat
--End BH
end if
end if
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tell -
Getting the classic "Macintosh Basics" tutorials to run in OSX (and Linux?)
Good afternoon folks,
I remember WAY back in the early days that there were really good basic tutorial programs that game with your new macintosh to teach you the basics. If my memory is correct, I THINK my favourite was the earliest one, "Mouse Basics". All I remember is that, as a kid, the first tutorial I had on a Mac was this silly little fun game to teach how to use a mouse, how to click, how to drag, etc. I vaguely remember a fishbowl was involved somehow, and there was another part where you dragged a piece of paper from a desk into a garbage can.
Heck, I think there may have been one for the pre-Mac Apples that was also really good.
Today, I have two uses for these programs, and I want to figure out how to get them to work on modern hardware.
1) My dad, believing the hype about OSX being the "easiest computer in the world to use" went and bought himself a really expensive iMac, thinking it would do EVERYTHING for him. Remember the scene from Star Trek IV where Scotty sits in front of the Mac Plus and says, "computer," into the mouse. That's pretty much the mindspace where my dad's coming from. Plus, my mom's even worse, and is having a really hard time grasping the concept of using a mouse. They want me get Skype working on their computer, but when I tried to help them out I discovered just how much they need to learn before they get CLOSE to the point where they can use Skype comfortably.
But, because all this stuff is so automatic for me, because I've been using computers since around 1986 when I got my first C=64, I cannot figure out how to verbalize these concepts into words in a way they can understand. Trying to explain to them the concept of the "desktop" as a metaphor is really hard. To them, a computer is a machine that does something FOR you, like a toaster. To me a computer is a virtual "space" that I "enter" in order to do things for myself.
For example, they might ask something like, "how do I get the computer to do x?" And I would answer, "this is how YOU do x." Or, to put it another way, they might unconsciously think to themselves, "I want the computer to give me the information I ask for," while I would unconsciously think ,"I want to go into the file system and find the information that's stored there." That's why it's called the "Finder" after all, right? It's a philosophical paradigm shift they just can't seem to make. So, they don't want me to teach them how to use Skype. They want me to teach Skype how to work for them! Somehow I cannot explain to them that an iMac is not a HAL 9000...
So, I want to use these very old basic tutorial programs on OSX as a way to get my parents some practice on the very very very basic skills needed to use a computer. How to click. How to drag. The concept of the "desktop". Etc.
Anybody have any simple tricks I can try? I suppose I could download QEMU for OSX and then install System 7 on their iMac, but it seems to me that there MUST be a simpler solution.
2) I'm trying to develop a remastered **** Small Linux livecd for my very young nieces and nephews to help introduce them to computers. The idea is to prevent my silly siblings from wasting their money on those stupid pink plastic "laptops" you can buy at Toys R Us. Instead, they'd simply take their old laptop that they don't use anymore and just boot it up with the DSL livecd. On the cd will be all sorts of age-appropriate games, educational software, and a kid-oriented internet browser (I'm trying to get zacbrowser to run under WINE, so far without any luck.)
There would be two users built-in to the livecd. If you boot it without using a password you get "kid mode" with a really friendly desktop with large cartoony icons with all the programs for the kid. If you boot it with the preconfigured password you'd get "parent mode" allowing access to preferences, utilities, and the myDSL package installation system.
Along with giving new life to my brother-in-laws' old laptops, they could also take the livecd with them when they're visiting other folk. Instead of dumping the kids in front of the tv, they can just pop the livecd in the family's computer and the kids can plug away without the ability to touch anything stored on the harddrive.
Think of it as SugarOS for really old hardware.
As you've probably guessed by now, I want to include these old Mac tutorials with the CD, and again I'm trying to figure out the best way to get them to run under Linux. Again, I could try running System 7 under QEMU, but I'd really like to find a better way. Is there such a thing as "WINE for classic macs"?
In the unlikely event that anybody has a way to modify these old programs to run natively under OSX (or Linux), that would be AWESOME!!!
Or if anybody knows of any modern substitutes to the classic Mac Basics tutorials, that would also be cool (but not nearly as cool as a way to run the original programs. I really really liked the way those suckers did the job.)
Thanks in advance!Hi, and a warm welcome to the forums!
Couple of thoughts...
You could get/use SheepShaver to actually run Classic Apps on Intel Macs.
For "Kid Mode" you could put other's Home folders on USB Sticks big enough. -
Aim to process all files in folders on desktop to run through photoshop and save in multiple locations
Part one:-
Gather information from desktop to get brand names and week numbers from the folders
Excluding folders on desktop beginning with "2" or "Hot"
Not sure about the list of folders
but I have got this bit to work with
set folderPath to "Hal 9000:Users:matthew:Desktop:DIVA_WK30_PSD" --<<this would be gained from the items on the desktop
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
After running this I have enough information to create folders in multiple locations, (i need to know where they are so that photoshop can later save them in those multiple locations
So I need the following folders created
Locally
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName: brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathA
Hal 9000:Users:matthew:Pictures:2011-2012:"WK" + weekNumber: brandName: brandName + "_WK" + weekNumber + "_HR"--(Set path for Later)PathB
Network
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:"Week" + weekNumber
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:"Week" + weekNumber:brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathC
Volumes:GEN:Website_Images --(no need to create folder just set path)PathD
FTP (Still as a normal Volume) So like another Network
Volumes:impulse:"Week" + weekNumber
Volumes:impulse:"Week" + weekNumber:Brand
Volumes:impulse:"Week" + weekNumber:Brand:brandName + "_WK" + weekNumber + "_LR" --(Set path for Later)PathE
Volumes:impulse:"Week" + weekNumber:Brand:brandName + "_WK" + weekNumber + "_HR" --(Set path for Later)PathF
I like to think that is end of Part 1
Part 2
Take the images (PSD's) from those folders relevant to the Brand then possibly run more applescript that opens flattens and then saves it in the locations above.
For example….
An image in folder DIVA_WK30_PSD will then run an applescript in Photoshop, lets call it DivaProcessImages within this we then save to PathA, PathB, PathC, PathD, PathE, PathF the folder path of C should therefore look like this
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:Week30:DIVA_WK30_LR and of course save the image as original filename.
Then from the next folder
An image in folder Free_WK30_PSD will then run an applescript in Photoshop, lets call it FreeProcessImages within this we then save to PathA, PathB, PathC, PathD, PathE, PathF the folder path of C should therefore look like this
Volumes:GEN:Brands:Zoom:Brands - Zoom:Upload Photos:2012:Week30:Free_WK30_LR and of course save the image as original filename.
The photoshop applescript i'm hoping will be easier as it should be a clearer step by step process without any if's and but's
Now for the coffee!!Hi,
MattJayC wrote:
Now to the other part, where each folder was created (and those that already existed) how do I set them as varibles?
For example,
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
This line was used to create more than one folder as it ran though the folders on the desktop. The next part is I will need to reference them to save files to them.
You can use a records
Examples
if you want the path of localBrandFolder_High_Res of "Diva", if "Diva" is the second folder of the Desktop
You get the path with this : localBrandFolder_High_Res of record 2 of myRecords
if you want the path of localWeekFolder in the first folder of the Desktop
You get the path with this : localWeekFolder of record 1 of myRecords
Here is the script
set myRecords to {}
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
repeat with i from 1 to number of items in dtF
set this_item to item i of dtF
if this_item does not start with "2_" and this_item does not start with "Hot" then
try
set folderPath to this_item
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
end try
try
set this_local_folder to "Hal 9000:Users:matthew:Pictures:2011-2012"
set var1 to my getFolderPath("WK" & weekNumber, this_local_folder)
set var2 to my getFolderPath(brandName, var1)
set var3 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var2)
set var4 to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", var2)
--set up names to destination folders and create over Netwrok including an already exisiting folder
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2012:"
set var5 to my getFolderPath("WK" & weekNumber, this_Network_folder)
set var6 to my getFolderPath(brandName, var5)
set var7 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var6)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set var8 to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set var9 to my getFolderPath(brandName, var8)
set var10 to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", var9)
set var11 to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", var9)
set end of myRecords to ¬
{localWeekFolder:var1, localBrandFolder:var2, localBrandFolder_Low_Res:var3, localBrandFolder_High_Res:var4, networkWeekFolder:var5, networkBrandFolder:var6, networkBrandFolder_Low_Res:var7, ftpWeekFolder:var8, ftpBrandFolder:var9, ftpBrandFolder_Low_Res:var10, ftpBrandFolder_High_Res:var11}
end try
end if
end repeat
localBrandFolder_High_Res of record 2 of myRecords -- get full path of localBrandFolder_High_Res in the second folder of Desktop
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath -
Move files and create unique name something wrong with my script
Can you see where I might be going wrong here?
Just trying to create a unique name if something exists.
In English.
Move file to the destinationFolder
Item exists in destinationFolder > Move file in the destination folder to the fake Trash > If it exists in fakeTrash too then give it a new name an ending of_a.psd then out it in the trash
Once thats done move start file to the destination folder.
Currently when the file exists in the destination folder and in the trash, I get the prompt then the error
error "System Events got an error: Can’t get disk item \"NN_FR10WW06290PK3LE.psd\"." number -1728 from disk item "NN_FR10WW06290PK3LE.psd"
set fileMatrix to {¬
{folderName:"BHS", prefixes:{"BH", "SM", "AL"}}, ¬
{folderName:"Bu", prefixes:{"BU"}}, ¬
{folderName:"Da", prefixes:{"ES"}}, ¬
{folderName:"Di", prefixes:{"DV"}}, ¬
{folderName:"Do", prefixes:{"DJ", "RA"}}, ¬
{folderName:"In", prefixes:{"GT", "CC"}}, ¬
{folderName:"Fr", prefixes:{"FR"}}, ¬
{folderName:"No", prefixes:{"NN"}}, ¬
{folderName:"Ma", prefixes:{"MA", "MF", "FI", "MC", "MH", "MB"}}, ¬
{folderName:"Pr", prefixes:{"PR"}}, ¬
{folderName:"To", prefixes:{"TM15", "TM11", "TM17"}}, ¬
{folderName:"Wa", prefixes:{"WA"}}, ¬
{folderName:"Se", prefixes:{"SE"}}}
tell application "Finder"
set theHotFolder to folder "Hal 9000:Users:matthew:Pictures:HotFolderDone"
set foldericon to folder "Hal 9000:Users:matthew:Pictures:Icons:Rejected Folder Done"
set fakeTrash to folder "Hal 9000:Users:matthew:FakeTrash"
---here
repeat with matrixItem in fileMatrix -- look for folder
set destinationFolder to (folders of desktop whose name starts with folderName of matrixItem)
if destinationFolder is not {} then -- found one
set destinationFolder to first item of destinationFolder -- only one destination
set theFolderName to name of destinationFolder
repeat with aPrefix in prefixes of matrixItem -- look for files
set theFiles to (files of theHotFolder whose namestarts with aPrefix) as alias list
if theFiles is not {} then repeat with startFile intheFiles -- move files
try
move startFile to destinationFolder
on error
activate
display dialog "File “" & (name ofstartFile) & "” already exists in folder “" & theFolderName & "”. Do you want to replace it?"buttons {"Don't replace", "Replace"} default button 2 with icon 1
if button returned of result is "Stop"then
if (count theLastFolder) is 0 thendelete theLastFolder
return
else if button returned of result is"Replace" then
set fileName to get name ofstartFile
if exists file fileName indestinationFolder then ¬
try
--next line moves existing file to the faketrash
move file fileName of destinationFolder to fakeTrash
move file startFile to destinationFolder
--if it already exists in fake trash give it a new name then move that file to fake trash
on error errmess numbererrnum -- oops (should probably check for a specific error number)
log "Error " & errnum& " moving file: " &errmess
set newName to mygetUniqueName(fileName,fakeTrash)
set name of fileNameto "this is a unique name"-- or whatever
set name of fileNameto newName
--Now move the renamed file to the fake trash
move file fileName to fakeTrash
--now move the startfile to destination folder
move file startFile to destinationFolder
end try
else -- "Don't replace"
if not (exists folder "Hal 9000:Users:matthew:Desktop:Rejected Folder Done") then
set theLastFolder toduplicate foldericonto desktop
else
set theLastFolder to folder"Hal 9000:Users:matthew:Desktop:Rejected Folder Done"
end if
delay 0.5
move startFile to theLastFolder with replacing
end if
end try
end repeat
end repeat
end if
end repeat
try
if (count theLastFolder) is 0 then delete theLastFolder
end try
end tell
to getUniqueName(someFile, someFolder)
check if someFile exists in someFolder, creating a new unique file name (if needed) by adding a suffix
parameters - someFile [mixed]: a source file path
someFolder [mixed]: a folder to check
returns [list]: a unique file name and extension
set {counter, suffixes, divider} to {0, "abcdefghijklmnopqrstuvwxyz", "_"}
set someFile to someFile as text -- System Events will use both Finder and POSIX text
tell application "System Events" to tell disk item someFile to set{theName, theExtension} to {name, name extension}
if theExtension is not "" then set theExtension to "." & theExtension
set theName to text 1 thru -((length of theExtension) + 1) of theName -- just the name part
set newName to theName & theExtension
tell application "System Events" to tell (get name of files of folder(someFolder as text))
repeat while it contains newName
set counter to counter + 1 -- hopefully there aren't more than 26 duplicates (numbers are easier)
set newName to theName & divider & (item counter ofsuffixes) & theExtension
end repeat
end tell
return newName
end getUniqueNameThere are numerous errors in your script, and it's a large script so there might be more, but these are the standouts for me:
At line 48 you:
set fileName to get name of startFile
which is fair enough - you then use this to see if the file already exists in the destinationFolder. However, if it does the logic about how to deal with that is flawed.
At line 56 you catch the error:
on error errmess number errnum -- oops (should probably check for a specific error number)
log "Error " & errnum & " moving file: " & errmess
set newName to my getUniqueName(fileName, fakeTrash)
set name of fileName to "this is a unique name" -- or whatever
set name of fileName to newName
--Now move the renamed file to the fake trash
move file fileName to fakeTrash
--now move the startfile to destination folder
move file startFile to destinationFolder
end try
so let's focus on that.
56: catch the error
57: log the error
58: generate a new unique filename
59: change the name of fileName to some other string
Hang on, wait a minute.... we already ascertained that at line 48 you defined fileName as a string object that indicates the name of the file. This is just a string. It's no longer associated with the original file... it's just a list of characters. Consequently you cannot set the 'name' of a string, hence your script is doomed to fail.
Instead, what I think you want to do is set the name of the startFile to the unique string. Files have filenames, and therefore you can set the name.
You have a similar problem on line 64 where you try to 'move file filename to fakeTrash'. fileName is just a string of characters. It isn't enough to identify a file - let's say the file name is 'some.psd'. You're asking AppleScript to move file some.psd to the trash. The question is which some.psd? The one on the desktop? in your home directory? maybe on the root of the volume? or maybe it should search your drive to find any/all files with that name? nope. None of the above. You can't just reference a file by name without identifying where that file is. So you probably want to 'move file fileName of destinationFolder...'
There may be other problems, but they're likely to be related - all issues with object classes (e.g. files vs. strings), or not being specific about which object you want.
As I said before, though, I might be way off - you don't say where the error is triggered to make it easy to narrow down the problem. Usually AppleScript will highlight the line that triggered an error. Knowing what that line is would help a lot. -
Open files in folder and repeat
How can i open the files in the folder if you scroll to "--open file items of the name folder" you can see where I am struggling to run the script.
How should this look to run, currently the script runs, with no errors or anything appearing in the folders.
property type_list : {"PHOTOSHOP"}
property extension_list : {"psd"}
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
repeat with i from 1 to number of items in dtF
set this_item to item i of dtF
if this_item does not start with "2_" and this_item does not start with "Hot" and this_item does not start with "Press" then
try
set folderPath to this_item
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
end try
end if
--set up names to destination folders and create locally based on brand name and week number
try
set this_local_folder to "Hal 9000:Users:matthew:Pictures:2011-2012"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
--set up names to destination folders and create over Netwrok including an already exisiting folder
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2012:"
set networkWeekFolder to my getFolderPath("WK" & weekNumber, this_Network_folder)
set networkBrandFolder to my getFolderPath(brandName, networkWeekFolder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkBrandFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
--open file items of the name folder
if brandName is equal to "Diva" then set filelist to (files of alias theFolder whose ¬
file type is in the type_list or name extension is in the extension_list)
repeat with alist in filelist
tell application "Finder"
set thefile to aFiles as alias
end tell
tell application "Adobe Photoshop CS5.1"
activate
set myOptions to {class:JPEG save options, quality:12}
tell front document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
delete layer "Original Image"
flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options ¬
{amount:80, radius:3.2, threshold:0}
save in file ((localBrandFolder_High_Res as string) & name) as JPEG with options myOptions without copying
tell application "Finder"
duplicate last file of localBrandFolder_High_Res to ftpBrandFolder_High_Res with replacing
end tell
--Prepare for Low RES by resetting image history
tell application "Adobe Photoshop CS5.1"
set current history state of current document to history state 3 ¬
of current document
end tell
resize image width 1020
resize image resolution 300 resample method none
filter current layer using unsharp mask with options ¬
{amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in file ((localBrandFolder_Low_Res as string) & name) as JPEG with options myOptions without copying
tell application "Finder"
duplicate last file of localBrandFolder_Low_Res to website_images with replacing
duplicate last file of localBrandFolder_Low_Res to ftpBrandFolder_Low_Res with replacing
duplicate last file of localBrandFolder_Low_Res to networkBrandFolder_Low_Res with replacing
end tell
--close file
close
end tell
end tell
end repeat
end try
end repeat
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPathThis is how it looks.
A few things i need to add.
How can I save of time by not having to save to the multiple locations (i did try t using finder to duplicate last file of folder but that didn't work too well)
Also the line where it saves to website_images in need to exclude those files that end in _2 and _3 (or files that are exactly 16 digits long).
And finally if in photoshop it come across and error I need to skip the file and log it to a text file or just leave it open and continue.
Also how do I have it run in the background so i can continue to use the computer?
and finally any other way to make it run faster?
property type_list : {"8BPS"}
property extension_list : {"psd"}
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
repeat with i from 1 to number of items in dtF
set this_item to item i of dtF
if this_item does not start with "2_" and this_item does not start with "Hot" and this_item does not start with "Press" then
set folderPath to this_item
set {oldTID, my text item delimiters} to {my text item delimiters, ":"}
set folderName to last text item of folderPath
set my text item delimiters to "_WK"
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Hal 9000:Users:matthew:Pictures:2011-2012"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
--taking the folder identify which process it must follow.
--taking the folder identify which process it must follow.
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2012:"
set networkWeekFolder to my getFolderPath("WK" & weekNumber, this_Network_folder)
set networkBrandFolder to my getFolderPath(brandName, networkWeekFolder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkBrandFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
if brandName is equal to "Diva" then
tell application "Finder" to set filelist to (files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
repeat with thefile in filelist
set thefile to thefile as string -- convert Finder item to string
-- D I V A Folder Photoshop Process
tell application "Adobe Photoshop CS5.1"
activate
open alias thefile
set myOptions to {class:JPEG save options, quality:12}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel "Quick Mask"
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--tell application "Finder"
--duplicate last file to folder ftpBrandFolder_High_Res with replacing
--end tell
-- example : duplicate file (localBrandFolder_High_Res & name) to folder localBrandFolder_Low_Res
--my duplicateFile(localBrandFolder_High_Res & name, localBrandFolder_Low_Res) -- use the handler to duplicate file
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1920
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
save in (networkBrandFolder_Low_Res) as JPEG with options myOptions without copying
save in (ftpBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
save in (website_images & name) as JPEG with options myOptions without copying
close
--my duplicateFile(localBrandFolder_Low_Res & name, aFolderPath) -- use the handler to duplicate file
end tell
end tell
end repeat
-- end brandName = "Diva"
else if brandName is equal to "another brandName 1" then
--another code
else if brandName is equal to "another brandName 2" then
--another code
end if
end if
end repeat
on duplicateFile(tFilePath, folderPath)
tell application "Finder"
duplicate file tFilePath to folder folderPath with replacing
end tell
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath -
Convert to Droplet and single use
Current this script that I have had a lot of help with takes a look at the desktop and collects all the folders on the desktop and process the files accordingly. Now I need to change is so that I can drop any folder on the droplet/script and then it will process the contents of the folder. Using the name of the folder.
Also I need to be able to make it run as a separate script. where by the file is dropped on to the droplet it will then need to recognise the name from the file.
ie
BR70NW012345 BR= brandName BRAND
MA65NW012345 MA= theMatts Folder name MATT
A prompt would then be required to enter the week number this allows it to then create the relevant folders. and then it would need to filter to use the correct process.
Here is what I have at the moment
Off to have a go myself. But definetly would appreciate the help.
Thanks
Matt
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "BRAND" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B R A N D Folder Photoshop Process
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end repeat
--End B R A N D
-- then the next brand then the next and so on
end if
end if
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tellThanks for getting back. Still having issues,
This is the script I have been working on, I'm sure I'm close. at the moment this does create the relevent folders, opens up the file does some of the process but does not save any files down? I suspect the error comes from the original line
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
That I changed to
set theFolder to eachItem as alias (I'm sure that wrong)
Thanks
Matt
--is this correct to have the property at the top still as when I put the "on open" it doesn't compile
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
--the Folder on the Desktop should be named like this
--BRAND_WK11_PSD
on open these_items
set oldTID to my text item delimiters
repeat with eachItem in these_items
tell application "Finder"
set my text item delimiters to "_WK"
set FolderEndName to last text item of (get name of eachItem)
set brandName to first text item of (get name of eachItem)
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
end tell
end repeat
set my text item delimiters to oldTID
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Network for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
set theFolder to eachItem as alias -- I think this is the line that could be causing the problem.
--In the Previous script it was "set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--taking the folder identify which process it must follow.
if brandName is equal to "BRAND" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B R A N D Folder Photoshop Process
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
end try
end tell
end repeat
--End B R A N D
--then the next brand
--then the next brand
end if
end open
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath -
Crearte folders based on file name and then do action
I've written this in the best possible step to step way as possible buti've no idea how to pull it altogether as a script. Hopefully its all there, just let me know if its still not clear, I would love the help if anyone can help sort this out for me.
Many Thanks
Matt
-there is a folder on the desktop called Season_SSxx_PSD where xx = a number
--This folder contains a quantity of PSD files that need to be processed the same but placed in different locations.
set theDesktopFolder to "Hal 9000:Users:matthew:Desktop"
set folderName to (folder of theDesktopFolder whose name starts with "SE")
--From the folderName
--set the seasonNumber to the item that follows Season_ and is before _PSD (the Season number should be SS13 but can change)
--Look at all files of folderName
--Files can be named like the following.
-- SE_BH70NW01234BM4BM
-- SE_BU40NW01234BM4BM
-- SE_ES20NW01234BM4BM
-- SE_DV25NW01234BM4BM
-- SE_DJ30NW01234BM4BM
-- SE_RA30NW01234BM4BM
-- SE_FR10NW01234BM4BM
-- SE_TM15NW01234BM4BM
-- SE_WA35NW01234BM4BM
-- Now set the brandIdentifier to Item that follows SE_ of the file names of the folderName
--Convert brandIdentifier to realName
--BH = BigandHuge
--BU = Buttons etc..
-- Now create the folders
--set up names to destination folders and create over Network for FTP collection (based on a mounted drive)
--set this_ftp_folder to "Impulse:"
--set ftpSeasonNumberFolder to my getFolderPath(seasonNumber, this_ftp_folder)
--Or Impulse:SS13:
--set ftpBrandFolder to my getFolderPath(realName, ftpSeasonNumberFolder)
--Or Impulse:SS13:BigandHuge:
--set ftpBrandFolder_High_Res to my getFolderPath(realName & seasonNumber & "_HR", ftpBrandFolder)
--Or Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:
--set ftpBrandFolder_High_PNG to my getFolderPath("_PNG", ftpBrandFolder_High_Res)
--Or Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:PNG:
--then the following
--Impulse:SS13:BigandHuge:BigandHuge_SS13_HR:JPG:
--Impulse:SS13:BigandHuge:BigandHuge_SS13_LR:PNG:
--Impulse:SS13:BigandHuge:BigandHuge_SS13_LR:JPG:
--Its these last 4 that will be used later.
--then all files begining with BH in the folderName do this photoshop action and save in the folders created from --above, then move on to the next file begining with BU create the relevant folders and then do the action as --before and so on.Cool that sorted the folder creation out without an issue, many thanks.
Just struggling to pin the photoshop part in.
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
set theDesktopFolder to "Hal 9000:Users:matthew:Desktop"
tell application "Finder" to set seFolder to (folders of folder theDesktopFolder whose name starts with "SE")
if seFolder is not {} then
set seFolder to item 1 of seFolder
tell application "Finder" to set tName to name of seFolder
set seasonNumber to my getText(tName) -- get Season Number
if seasonNumber is not "" then
set list1 to {"BH", "BU", "ES", "DV", "DJ", "RA", "FR", "TM", "WA"}
set list2 to {"BHS", "Burtons", "DaisyAndEve", "Diva", "DorothyPerkins", "DorothyPerkins", "Freedom", "TopMan", "Wallis"} -- you must complete this list ***
set tc to count list2
repeat with i from 1 to tc
set brandIdentifier1 to item i of list1
set brandIdentifier to item i of list2 -- the real name
--first item = all files begining with BH
tell application "Finder" to set theseFiles to (files of seFolder whose name starts with "SE_" & brandIdentifier1) as alias list
if theseFiles is not {} then
--local Folders
set this_local_folder to "Images:2012-2013"
set localSeasonNumberFolder to my getFolderPath("SS" & seasonNumber, this_local_folder)
set localSeasonFolder to my getFolderPath(brandIdentifier, localSeasonNumberFolder)
set localSeasondFolder_PSD to my getFolderPath("PSD", localSeasonFolder)
-- *** Now create the folders ***
set this_ftp_folder to "Impulse:"
set ftpSeasonNumberFolder to my getFolderPath("SS" & seasonNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandIdentifier, ftpSeasonNumberFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandIdentifier & "_SS" & seasonNumber & "_HR", ftpBrandFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandIdentifier & "_SS" & seasonNumber & "_LR", ftpBrandFolder)
--Use the folders below within Photoshop
set ftpBrandFolder_High_PNG to my getFolderPath("PNG", ftpBrandFolder_High_Res)
set ftpBrandFolder_Low_PNG to my getFolderPath("PNG", ftpBrandFolder_Low_Res)
set ftpBrandFolder_High_JPG to my getFolderPath("JPG", ftpBrandFolder_High_Res)
set ftpBrandFolder_Low_JPG to my getFolderPath("JPG", ftpBrandFolder_Low_Res)
--- *** end create the folders ***
repeat with i in theseFiles
set tFile to i as string
--taking the folder identify which process it must follow.
if brandIdentifier is equal to "BHS" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H S Folder Photoshop Process
set thisName to (item j of o's theseNames)
tell application "Finder"
set t_ext to name extension of file thefile
if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
set b to exists file (localSeasondFolder_PSD & thisName & ".psd")
end tell
if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localSeasondFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (ftpBrandFolder_High_JPG & name) as JPEG with options myOptions without copying
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (ftpBrandFolder_Low_JPG & name) as JPEG with options myOptions without copying
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if
end repeat
--End BHS
--taking the folder identify which process it must follow. W A L L I S
else if brandIdentifier is equal to "Wallis" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- W A L L I S Folder Photoshop Process
set thisName to (item j of o's theseNames)
tell application "Finder"
set t_ext to name extension of file thefile
if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
set b to exists file (localSeasondFolder_PSD & thisName & ".psd")
end tell
if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localSeasondFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1020
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if
end repeat
--End W A L L
end if
end if
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on getText(t)
set {oTID, text item delimiters} to {text item delimiters, "_"}
try
set r to ""
set r to text -2 thru -1 of (text item -2 of t)
end try
set text item delimiters to oTID
return r
end getText
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath -
[SOLVED] X fails after pacman -Syu
After a year or so without upgrading (not recommended) I did a pacman -Syu; it took like ages 'cause I was on kernel 2.26, and now my arch is a complete mess: user modules don't load at boot, dhcpcd is not working so I don't have internet access and the X server is erratic too. Now I have to repair it step by step, and I think I should start with X.
Here is the startx/ xinit output:
[root@HAL-9000 ~]# startx
xauth: (argv):1: bad display name "HAL-9000:0" in "list" command
xauth: (stdin):1: bad display name "HAL-9000:0" in "add" command
X.Org X Server 1.11.2
Release Date: 2011-11-04
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.1.1-1-ARCH i686
Current Operating System: Linux HAL-9000 3.1.1-1-ARCH #1 SMP PREEMPT Fri Nov 11 22:05:37 UTC 2011 i686
Kernel command line: root=/dev/disk/by-uuid/67fb73d6-b981-47d1-a07c-223b5b730551 ro vga=0x0318
Build Date: 16 November 2011 11:26:40AM
Current version of pixman: 0.24.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sun Nov 20 19:02:40 2011
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using config directory: "/etc/X11/xorg.conf.d"
(EE) synaptics: Touchpad: Synaptics driver unable to detect protocol
(EE) PreInit returned 11 for "Touchpad"
gnome-session: error while loading shared libraries: libdevkit-power-gobject.so.1: cannot open shared object file: No such file
or directory
xinit: connection to X server lost
waiting for X server to shut down Server terminated successfully (0). Closing log file.
I guess the gnome-session error with libdevkit-powe-gobject.so.1 is what causes the x server to close. And this is the complete X log:
http://pastebin.com/UBficJVi
*note: I have a Nvdia card which already worked perfectly with the privative driver, and supposedly I still have gnome 2 (that was the only packages group I didn't upgrade)
Last edited by isacdaavid (2011-11-21 06:27:07)isacdaavid wrote:
knopwob wrote:
isacdaavid wrote:*note: I have a Nvdia card which already worked perfectly with the privative driver, and supposedly I still have gnome 2 (that was the only packages group I didn't upgrade)
So you updated everything except gnome-stuff? Update the gnome-stuff.
But I'm all for gnome 2 , and X should work despite of the gnome version or the desktop environment. Shouldn't it?
No, not if you're using gdm or autoboot into gnome or something similar.
gnome-session: error while loading shared libraries: libdevkit-power-gobject.so.1: cannot open shared object file: No such file
or directory
This sounds like one of gnome-sessions dependencies have been updated and isn't compatible with gnome-session anymore.
Before you continue trying to repair your system, you should read this -
Photoshop Overwrite exisiting file
I'm using this line to write over an exisiting document if it exists already
save in (localBrandFolder_PSD) as Photoshop format with options myPSDOptions without copying
This doesn't give the expected behaviour.
Previously on other applescript I have used it in this was
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions with replacing
As you can see in this script it turns green and hence won't work.
Any pointers please
MatThis might help, this is the beginning of the script.
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Hal 9000:Users:matthew:Pictures:2011-2012"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2012:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "DCKGEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "Impulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "Matt" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- M a t t Folder Photoshop Process
tell application "Adobe Photoshop CS6"
-- I remove the command activate, Photoshop stay in background
try
open (alias thefile) showing dialogs never
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten -
Photoshop CS5 save with same name to a folder, also smartsharpen?
I thought this would be easier, just trying to save a file down with its current filename to a folder.
On a side note I couldn't see the option in the Library for Smart Sharpen (not the unsharp mask) Can this be done?
Matt
tell application "Finder"
set highResFolder to "Hal 9000:Users:matthew:Desktop:HR" as alias
set lowResFolder to "Hal 9000:Users:matthew:Desktop:LR" as alias
end tell
tell application "Adobe Photoshop CS5.1"
activate
tell front document
delete layer "Original Image"
flatten
resize image resolution 300 resample method none
set myOptions to {class:JPEG save options, quality:12}
save in folder highResFolder as JPEG with options myOptions appending no extension without copying
close the current document saving no
end tell
end tellMight have it!, still can't find the Smart sharpen so played with unsharp mask.
tell application "Finder"
set highResFolder to "Hal 9000:Users:matthew:Desktop:HR" as alias
set lowResFolder to "Hal 9000:Users:matthew:Desktop:LR" as alias
end tell
tell application "Adobe Photoshop CS5.1"
activate
set myOptions to {class:JPEG save options, quality:12}
tell front document
delete layer "Original Image"
flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options ¬
{amount:80, radius:3.2, threshold:0}
--insert save option save in folder highResFolder as JPEG with options myOptions appending no extension without copying
save in file ((highResFolder as string) & name) as JPEG with options myOptions without copying
--Save for all HR JPEGS
--Prepare for Low RES by resetting image history
tell application "Adobe Photoshop CS5.1"
set current history state of current document to history state 3 ¬
of current document
end tell
resize image width 1020
resize image resolution 300 resample method none
filter current layer using unsharp mask with options ¬
{amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in file ((lowResFolder as string) & name) as JPEG with options myOptions without copying
--close file
close
end tell
end tell -
E72 - How well does it work with Garmin Mobile XT?
I bought Garmin Mobile XT for my mobile and successfully installed it, but it stops responding after a while, maybe some 5-10 minutes. Has anyone else tried it with the E72?
"The 9000 series is the most reliable computer ever made." HAL 9000
Solved!
Go to Solution.Ahhh, damn it! Ovi Maps doesn't cover Serbia (yeah, we're heaven forsaken, I know). Good thing I didn't actually buy Garmin and then figured it doesn't work.. I was considering buying it actually. Go figure - the map of Serbia, which is basically a third world country in the middle of Europe, costs exactly as much as the maps covering most of Europe. That just s*cks.
You've got kudos from me for advice, thanks!
Do you happen to know any other GPS software that does work on the E72?
"The 9000 series is the most reliable computer ever made." HAL 9000 -
I just got my computer back completely reformatted, and now need to set up my mail accounts again. Previously, it was done in store. I need to set up two g-mail accounts and one mindspring account. I need help to know what the Incoming Mail Server would be, etc. thank you.
In general, your service provider should give you this information (if you don't have it backed up). For gmail, see the GMail POP setup help.
HAL 9000 -
Getting rid of computer...what I do to wipe my info?
I am getting rid of an old computer with OSX. What measures should I take so that the new owner will have a fresh start without any of my info still available.
I am hoping there is a way of doing this without wiping the HD and reinstalling the OS.
I guess I should say that this is an office computer going to another office of my company, so there is no VERY personal info, just work related. So I just need a basic account wipe.
1.5 GHz PowerPC G4 Powerbook Mac OS X (10.4.7) 1.25 GB RAM
1.5 GHz PowerPC G4 Powerbook Mac OS X (10.4.7) 1.25 GB RAMI'm assuming that you have not been putting things outside your home directory.
If you have admin access to the computer, the easiest thing would be to create an account for the new user with access to administer the computer, log in as that user, and delete your existing user. If you press the "Delete immediately" button when asked, it will remove your whole user folder in addition to your ID. The new account will be fresh and will have default preferences when they user uses applications.
If you do not have administrative access, you can pretty much get the same result by deleting everything in each of the folders in your home directory (and any stray files in your home directory).
If you are concerned about people trying to restore files you've deleted, it might be a good idea to investigate utilities that will write over the open space after you've deleted the files, and you might want to eliminate system logs if you've been doing anything you really don't want people to know about.
HAL 9000 The only way to be really sure is to destroy the disk and put in a new one.
Maybe you are looking for
-
Logical operations on binary columns
We need to store approx 200 bitfields so we thought we'd use a binary datatype. We can set the bit fields easily using set bitfield = bitfield | 1 set bitfield = bitfield | 2 set bitfield = bitfield | 4 However we don't want to hard-co
-
Hi All! Is there a report/table in SAP which shows all the Open PO numbers i.e which has not been complete yet? Thanks jean
-
How to execute the CONNECT command in sql
Hi , I am using DB2 database and I need to execute the sql statement CONNECT TO Database user username USING password. Can anyone tell me how to execute this query in java. I tried this by using executeQuery but it was giving a sexception somtehing a
-
Hi there!?I have a Creative Zen Touch with the PlayForSure firmware installed (few weeks ago). The problem starts?when I try to transfer any huge?file (the file I tried was greater than 450MB), it gives me the error "Not enough storage is available t
-
CFSTKE* Queues with few entries executing for long durations (10 hrs)
In APO 7.0 the CFSTKE* Queues with few entries executing for long durations (10 hrs) Below are the FM from the queue /SAPAPO/CIF_IRQ_REDUCT_INBOUND /SAPAPO/CIF_STOCK_INBOUND /SAPAPO/CIF_SL_DOC_INBOUND /SAPAPO/CIF_SL_DOC_INBOUND Do any one have the