how to fix delimiter in this applescript?
My goal is to take a directory with files with multiple names that follows the same general rule:
{_jackm-12334-02-01.jpg , _namid-0231-103-0123.jpg , _neverbe-03342-232.jpg ......"
these files moved into subfolders of their own with only the "word" such as "_jackm" as the name of the folder and only files with _jackm inside it ... etc.
here is the script, but having a problem with delimiter,
error "Finder got an error: Can’t get text item delimiters." number -1728 from text item delimiters
--script begins
on run
set theFolder to ""
set fileList to {}
set theTarget to ""
set theText to ""
set TID to {}
set textItems to {}
tell application "Finder"
set theFolder to (choose folder with prompt "Choose containing folder:" without invisibles and multiple selections allowed)
set fileList to every file of theFolder
repeat with i in fileList
name of i as text
set theText to "_londondire_123455-901-34"
set {TID, text item delimiters} to {text item delimiters, "-"}
set textItems to text items of theText
set text item delimiters to TID
set theResult to item 1 of textItems -- "londondire"
try
set theTarget to ((theFolder as text) & theText) as alias
move i to theTarget
on error
make new folder at theFolder with properties {name:theText}
move i to result
end try
end repeat
end tell
end run
--script ends
The term is "Applescript's text item delimiters" not just "text item delimiters"
最後更新:2017-08-18 09:28:46
上一篇:
MB Pro(2017)no longer see Bonjour printer
下一篇:
How to find "repair permissions"?
removing hard drive iMac 24 inch 2007
Thunderbolt Does Not Detect Display
about enable trim on macOS sierra
iPad 2 honda link
iTunes will not delete photos from iPhone after...
I bought more iCloud storage but it still sayin...
magic keyboard numeric volume keys not working
Inconsistant recording of exercise time
iMac 20 OS X support
Free wifi connection issue iOS 10
相關內容
"com.apple.installer.pagecontroller error
any idea what error 3503 is?
Underallocation Detected on Main device
The operation couldn’t be completed. (BKA...
is ctoid.exe a virus on my ipad safari browser?
iTunes Error: Declined to authorize this image ...
Keep High Efficiency Original if Available Chec...
iTunes 12.7 cannot edit playlist
High Sierra Stuck & Decryption paused
Need to unlock iphone 5 to reactivate the phone...
熱門內容
Christian Music Removed From Itunes
I'm being billed twice every month for Apple Mu...
iMac running slow
Fix disappearing album art after moving iTunes
Activation Locked iWatch
Can I change the iwatch to miles instead of kil...
I keep seeing the "You don't have permission to...
can't read any menus macbook air
iPad 2, iOs9.3, taking days to restore
charges made under itune memeberships