text
stringlengths
0
15.7k
source
stringlengths
6
112
if xmlvalue(infoString, "pcs") is not equal to "" then
lns3.scpt
set descriptionString to xmlvalue(infoString, "description")
lns3.scpt
set theButton to button returned of (display dialog "filename: " & fileName & return & "description: " & descriptionString & return & return & "Change description string to match the filename?" buttons {"no", "other...", "filename"} default button 3)
lns3.scpt
if theButton is "other..." then
lns3.scpt
set newName to text returned of (display dialog "Enter new profile description string" default answer descriptionString)
lns3.scpt
set cmdLine to ("sips -s description '" & newName & "' " & filePath) as string
lns3.scpt
do shell script cmdLine
lns3.scpt
else if theButton is "filename" then
lns3.scpt
set newName to fileName
lns3.scpt
display dialog "Remove the embedded profile from an image."
lns3.scpt
set chosenFile to choose file with prompt "Choose an image " default location path to desktop folder
lns3.scpt
set cmdLine to ("sips -d profile --deleteColorManagementProperties " & filePath) as string
lns3.scpt
display dialog "Proof an image through one space into another space."
lns3.scpt
set proofProf to choose file with prompt "Choose an intermediate space profile" default location POSIX file "/System/Library/ColorSync/Profiles"
lns3.scpt
set destProf to choose file with prompt "Choose a destination space profile" default location POSIX file "/System/Library/ColorSync/Profiles"
lns3.scpt
set proofProfPath to quoted form of POSIX path of proofProf
lns3.scpt
set destProfPath to quoted form of POSIX path of destProf
lns3.scpt
set cmdLine to ("sips --matchTo " & proofProfPath & " " & filePath) as string
lns3.scpt
set cmdLine to ("sips --matchTo " & destProfPath & " " & filePath) as string
lns3.scpt
display dialog "Match an image to another color space."
lns3.scpt
set matchProf to choose file with prompt "Choose destination space profile" default location POSIX file "/System/Library/ColorSync/Profiles"
lns3.scpt
set profPath to quoted form of POSIX path of matchProf
lns3.scpt
set cmdLine to ("sips --matchTo " & profPath & " " & filePath) as string
lns3.scpt
display dialog "Extract the embedded profile from an image."
lns3.scpt
set chosenFile to choose file with prompt "Choose an image"
lns3.scpt
set cmdLine to ("sips -g profile " & filePath) as string
lns3.scpt
set originalDelimiters to AppleScript's text item delimiters
lns3.scpt
set AppleScript's text item delimiters to ": "
lns3.scpt
set internalName to item 2 of (text items of infoString)
lns3.scpt
if internalName is equal to "<nil>" then
lns3.scpt
display dialog "no profile in " & (thisFile as text) buttons {"OK"} default button 1
lns3.scpt
set strCount to count characters of internalName
lns3.scpt
if strCount > 251 then
lns3.scpt
set newProfileName to ((characters 1 through 251 of internalName) & ".icc") as string
lns3.scpt
set newProfileName to (internalName & ".icc") as string
lns3.scpt
set newFilePath to choose file name default name newProfileName with prompt "Save profile as..."
lns3.scpt
move item (newFilePath as alias) to trash
lns3.scpt
set newFilePosixPath to quoted form of POSIX path of newFilePath
lns3.scpt
set imageFilePosixPath to quoted form of POSIX path of thisFile
lns3.scpt
set cmdLine to ("sips --extractProfile " & newFilePosixPath & " " & imageFilePosixPath) as string
lns3.scpt
display dialog "Embed a profile into an image."
lns3.scpt
set embedProf to choose file with prompt "Choose profile to embed" default location POSIX file "/System/Library/ColorSync/Profiles"
lns3.scpt
set profPath to quoted form of POSIX path of embedProf
lns3.scpt
set cmdLine to ("sips --embedProfile " & profPath & " " & filePath) as string
lns3.scpt
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
lns3.scpt
set the alert_message to the comment of this_folder
lns3.scpt
if the alert_message is not "" then
lns3.scpt
display dialog alert_message buttons {"Open Comments", "Clear Comments", "OK"} default button 3 giving up after dialog_timeout
lns3.scpt
set the user_choice to the button returned of the result
lns3.scpt
if the user_choice is "Clear Comments" then
lns3.scpt
set comment of this_folder to ""
lns3.scpt
else if the user_choice is "Open Comments" then
lns3.scpt
open information window of this_folder
lns3.scpt
property done_foldername : "Rotated Images"
lns3.scpt
property type_list : {"JPEG", "TIFF", "PNGf"}
lns3.scpt
property extension_list : {"jpg", "jpeg", "tif", "tiff", "png"}
lns3.scpt
if not (exists folder done_foldername of this_folder) then
lns3.scpt
make new folder at this_folder with properties {name:done_foldername}
lns3.scpt
set current view of container window of this_folder to list view
lns3.scpt
set the target_folder to folder done_foldername of this_folder
lns3.scpt
set the item_info to the info for this_item
lns3.scpt
if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
lns3.scpt
my resolve_conflicts(this_item, target_folder)
lns3.scpt
set the target_file to (move this_item to the target_folder with replacing) as alias
lns3.scpt
process_item(target_file)
lns3.scpt
if the error_number is not -128 then
lns3.scpt
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
lns3.scpt
on resolve_conflicts(this_item, target_folder)
lns3.scpt
set the file_name to the name of this_item
lns3.scpt
if (exists document file file_name of target_folder) then
lns3.scpt
set file_extension to the name extension of this_item
lns3.scpt
if the file_extension is "" then
lns3.scpt
set the trimmed_name to the file_name
lns3.scpt
set the trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name
lns3.scpt
set the name_increment to 1
lns3.scpt
set the new_name to (the trimmed_name & "." & (name_increment as string) & "." & file_extension) as string
lns3.scpt
if not (exists document file new_name of the target_folder) then
lns3.scpt
set the name of document file file_name of the target_folder to the new_name
lns3.scpt
set the name_increment to the name_increment + 1
lns3.scpt
end resolve_conflicts
lns3.scpt
on process_item(this_item)
lns3.scpt
set this_item to this_item as string
lns3.scpt
with timeout of 900 seconds
lns3.scpt
launch -- always use with Folder Actions
lns3.scpt
set this_image to open file this_item
lns3.scpt
rotate this_image to angle 90.0
lns3.scpt
save this_image with icon
lns3.scpt
close this_image
lns3.scpt
on error error_message
lns3.scpt
end process_item
lns3.scpt
rotate this_image to angle 270.0
lns3.scpt
property done_foldername : "Processed Images"
lns3.scpt
property type_list : {"JPEG", "TIFF", "GIFf", "PICT", "8BIM", "PNGf"}
lns3.scpt
property extension_list : {"jpg", "jpeg", "tif", "tiff", "gif", "pct", "pict", "psd", "png"}
lns3.scpt
using terms from application "Image Events"
lns3.scpt
property color_spaces : {Eight channel, Eight color, Five channel, Five color, Seven channel, RGB, Lab, XYZ, Six channel, CMYK, Six color, Seven color, named, Gray}
lns3.scpt
property color_space_titles : {"Eight channel", "Eight color", "Five channel", "Five color", "Seven channel", "RGB", "Lab", "XYZ", "Six channel", "CMYK", "Six color", "Seven color", "Named", "Gray"}
lns3.scpt
property bit_depths : {sixteen colors, color, four grays, black & white, thousands of colors, grayscale, two hundred fifty six grays, four colors, sixteen grays, millions of colors, best, two hundred fifty six colors, millions of colors plus}
lns3.scpt
property bit_depth_titles : {"sixteen colors", "color", "four grays", "black & white", "thousands of colors", "grayscale", "256 grays", "four colors", "sixteen grays", "millions of colors", "best", "256 colors", "millions of colors plus"}
lns3.scpt
set the target_folder to (make new folder at this_folder with properties {name:done_foldername})
lns3.scpt