Hi,
can i get support cyrillic symbols in filenames? In Xcode i got an error, in AS all work well…
Hi,
can i get support cyrillic symbols in filenames? In Xcode i got an error, in AS all work well…
Where are you using them, and what errors are you getting?
Hi, Shane.
on |application|:theApp openFiles:fileList
repeat with aFile in (fileList as list)
copy aFile to end of droppedFiles
end repeat
my setFilesList:fileList -- procedure for set list of dropped items, sort them and count
set my vectorCount to count of vectorFilesName
set my rasterCount to count of rasterFilesName
-- log vectorCount & rasterCount
if vectorCount < 1 and rasterCount < 1 then
secondWindow's orderFront:me
firstWindow's orderOut:me
else
my verifyFilesAndPath_()
end if
end |application|:openFiles:
I try to get a list of dropped items, include mixed files name (file_КИР.ext for example) and got an error: File file_???.ext wasn’t found.
In our agency every one save a files like them like… “file_name_400x300mm.ext” can have a ciryllic symbol “x” between 400 and 300
AS did working well with this names.
It’s still not clear where the error is happening. I don’t understand what the first repeat loop does. What does setFilesList: do? And verifyFilesAndPath_()? You need to add some log statements to see exactly where the error is being generated.
on |application|:theApp openFiles:fileList
my setFilesList:fileList -- procedure for set list of dropped items, sort them and count
set my vectorCount to count of vectorFilesName
set my rasterCount to count of rasterFilesName
-- log vectorCount & rasterCount
if vectorCount < 1 and rasterCount < 1 then
secondWindow's orderFront:me
firstWindow's orderOut:me
else
my verifyFilesAndPath_()
end if
end |application|:openFiles:
Error in this module:
------------------------------------------
-- Count and sort files in droppeditems --
------------------------------------------
on setFilesList:these_items
--log "Start module setFilesList:these_items"
repeat with aFile in these_items
--display dialog aFile as text
try -- #1
set droppedPath to aFile as string
set the itemInfo to info for droppedPath -- Get file info
on error the error_message number the error_number
tell me
activate
display alert ¬
"Sorry, module \"setFilesList\" got an error “" message ¬
"#1. Unable to get the info from item: " & the error_number & ". " & the error_message
end tell
exit repeat
my appWillClose_()
end try
(*
In try -- #1
error -43: File /Users/Path/File_???.ai wasn't found
where ??? is a cyrillic symbols in file name
*)
---------------------------------
-- If current item is a folder --
---------------------------------
if folder of the itemInfo is true then
my process_folder_(aFile)
else
try
set this_name to name of itemInfo
end try
try
set this_extension to the name extension of itemInfo
on error
set this_extension to ""
end try
try
set this_filetype to the file type of itemInfo
on error
set this_filetype to ""
end try
try
set this_typeID to the type identifier of itemInfo
on error
set this_typeID to ""
end try
set this_DefaultAPP to the default application of itemInfo
set item_alias to the alias of itemInfo
--------------------------------------
-- verify file types, and separate it to vector and raster
--------------------------------------
if (folder of the itemInfo is false) and (item_alias is false) ¬
and ((this_filetype is in the vectorTypeList) ¬
or (this_extension is in the vectorExtensionList) ¬
or (this_typeID is in vectorTypeIDsList)) ¬
then
copy droppedPath to end of vectorFilesName
else if (folder of the itemInfo is false) and (item_alias is false) ¬
and ((this_filetype is in the rasterTypeList) ¬
or (this_extension is in the rasterExtensionList) ¬
or (this_typeID is in rasterTypeIDsList)) ¬
then
copy droppedPath to end of rasterFilesName
end if
--------------------------------------
end if
end repeat
-- display dialog "End module setFilesList:these_items"
return true
end setFilesList:
It’s hard to tell by just looking, and there are variables that I presume are properties. But a couple of things:
Methods that begin with “set” have a special meaning in Cocoa, and it is usually reserved for setting properties. It may not matter here, but following the naming conventions is a good idea generally.
File types are long dead.
I wouldn’t be surprised if the problem is with info for, or the fact that you’re passing it a POSIX path. You could try replacing info for with the Cocoa equivalents.
But first you should insert lots of NSLog() statements, until you find exactly where the problem is happening.
Thanks for response, Shane
script LEXAppDelegate
property parent : class "NSObject"
-- IBOutlets
property window : missing value
on |application|:theApp openFiles:fileList
try
-- repeat with aFile in fileList -- old
repeat with aFile in (fileList as list) -- new
set myPath to aFile as string
set the itemInfo to info for myPath -- Get file info
log myPath as text
end repeat
on error the error_message number the error_number
tell me
activate
display alert ¬
"Module \"openDroppedItem\" got an error “" message ¬
"unable to work with selected files: " & the error_number & ". " & the error_message
end tell
end try
end |application|:openFiles:
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
I did replaced:
in first case i have path to my file like /Users/myuser/Work/Testfolder/Layers01/Layers02/Layers03/Layers_03_???.ai
in second /Users/myuser/Work/Testfolder/Layers01/Layers02/Layers03/Layers_03_КИР.ai
and all work well… I need to smoke a manual, and maybe i’ll become a Shaman, b-r-r an XCoder :rolleyes: