Hi all!
I have try to modify and run my old scripts (lake that) with ASObjC_Explorer_4 (from Shane Stanley).
But i don’t understand how do it…
What i should write in left (calling script) and right (main script) windows for that?
using terms from application "ASObjC Runner-N" -- needed to compile script
(* ======== Общие переменные Ð´Ð»Ñ Ñ€Ð°Ñтровых и векторных типов файлов ======== *)
-- Raster images files formats
property rasterTypeList : {"8BPS", "8BPB", "TIFF", "PNGf"}
property rasterExtensionList : {"psd", "psb", "tif", "tiff", "png"}
property rasterTypeIDsList : {"public.png", "com.adobe.photoshop-image", "dyn.ah62d4rv4ge81a65c", "public.tiff"}
-- Vector images files formats
property vectorTypeList : {"EPSP", "PDF"}
property vectorExtensionList : {"ai", "eps", "pdf"}
property vectorTypeIDsList : {"com.adobe.illustrator.ai-image", "com.adobe.encapsulated-postscript", "com.adobe.pdf"}
property outputFolder : missing value -- путь Ð´Ð»Ñ ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¿Ñ€ÐµÐ²ÑŒÑŽ файлов
property inputFolder : missing value -- путь Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸ оригинальных файлов
property previewResolution : missing value
property previewSize : missing value
property previewQuality : missing value
global filesCounter -- Ñчетчик обработанных файлов
global validFiles -- Ñчетчик поддерживаемых файлов
property vectorFilesName : {}
property rasterFilesName : {}
property containerVectorFiles : {}
property containerRasterFiles : {}
property myTitle : "Convert to JPEG"
property buttonCancel : "Cancel" as text
property buttonOk : " Ok " as text
property buttonRepeat : "Repeat" as text
property buttonContinue : "Continue" as text
property runnerPath : "" -- get path to bundled copy, in this case directly in the Resources folder
on open droppeditems
set mySelf to path to me as text # ADDED
if runnerPath does not start with mySelf then set runnerPath to "" # ADDED
set runnerPath to (path to resource "ASObjC Runner-N.app") as text
my setFilesList(droppeditems)
---------------------------
set vectorFilesCount to the count of the vectorFilesName
set rasterFilesCount to the count of the rasterFilesName
if vectorFilesCount < 1 and rasterFilesCount < 1 then
my unsupportedFormat() -- select nothing
return
end if
---------------------------
try
set outputFolder to (choose folder with prompt "Choose folder for JPEG files:") as string -- choose folder to save
on error
tell me
activate
display alert ¬
"Sorry, an error has occured" message ¬
"Was an incorrect values for the Output Folder." buttons {buttonCancel} default button 1
end tell
return
end try
repeat with aFile from 1 to the count of vectorFilesName
try
tell application runnerPath
parsed path aFile
set pathComponents to path components of (parsed path aFile) as list
set fileContainer to containing item of (parsed path aFile)
set shortFileName to name stub of (parsed path aFile)
set fullFileName to name of (parsed path aFile)
set nameExtension to name extension of (parsed path aFile)
end tell
on error the error_message number the error_number
tell me
activate
display alert ¬
"Sorry, an error has occured" & the error_number & ". " & the error_message ¬
buttons {buttonCancel} default button 1
end tell
end try
tell me
activate
try
display dialog ¬
"Компонеты пути “ " & pathComponents & return & return & ¬
"Контейнер “ " & fileContainer
on error the error_message number the error_number
tell me
activate
display alert ¬
"Sorry, an error has occured" & the error_number & ". " & the error_message ¬
buttons {buttonCancel} default button 1
end tell
end try
end tell
end repeat
end open
-- This droplet processes files dropped onto the applet
on setFilesList(these_items)
set vectorFilesName to {}
set rasterFilesName to {}
set containerVectorFiles to {}
set containerRasterFiles to {}
repeat with i from 1 to the count of these_items
set this_item to alias (item i of these_items)
set the item_info to info for this_item
if folder of the item_info is true then
set levelOfInsert to 1
process_folder(this_item)
else
try
set this_extension to the name extension of item_info
on error
set this_extension to ""
end try
try
set this_filetype to the file type of item_info
on error
set this_filetype to ""
end try
try
set this_typeID to the type identifier of item_info
on error
set this_typeID to ""
end try
--------------------------------------
-- verify file types, and separate it to vector and raster
--------------------------------------
if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the vectorTypeList) or (this_extension is in the vectorExtensionList) or (this_typeID is in vectorTypeIDsList)) then
copy this_item to end of vectorFilesName
else if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the rasterTypeList) or (this_extension is in the rasterExtensionList) or (this_typeID is in rasterTypeIDsList)) then
copy this_item to end of rasterFilesName
end if
--------------------------------------
end if
end repeat
return
end setFilesList
-- this sub-routine processes folders
on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
set levelOfInsert to levelOfInsert + 1
process_folder(this_item)
else
try
set this_extension to the name extension of item_info
on error
set this_extension to ""
end try
try
set this_filetype to the file type of item_info
on error
set this_filetype to ""
end try
try
set this_typeID to the type identifier of item_info
on error
set this_typeID to ""
end try
--------------------------------------
-- verify file types, and separate it to vector and raster
--------------------------------------
if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the vectorTypeList) or (this_extension is in the vectorExtensionList) or (this_typeID is in vectorTypeIDsList)) then
copy this_item to end of vectorFilesName
else if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the rasterTypeList) or (this_extension is in the rasterExtensionList) or (this_typeID is in rasterTypeIDsList)) then
copy this_item to end of rasterFilesName
end if
--------------------------------------
end if
end repeat
return
end process_folder
(*===== Ðет поддерживаемых файлов =====*)
on unsupportedFormat()
tell me
activate
display dialog ¬
"You do not select any files" & return & "or file type is not supported" buttons {buttonCancel} default button 1 with title myTitle with icon stop
end tell
return
end unsupportedFormat
end using terms from
best regards, Alex.