I am not sure what I am doing wrong the below script. Can someone point me in the right direction?
tell application “Finder”
set _excel to choose file
set _folder to choose folder
end tell
tell application “Microsoft Excel”
open _excel
set _surname to value of range “A1:A40” as list
set _firstname to value of range “B1:B40” as list
close active workbook
end tell
tell application “Finder”
repeat with _foldername in _surname
make new folder at folder _folder with properties {name:{(item 1 of _surname as text) & " " & (item 1 of _firstname as text)}}
end repeat
end tell
This Succefully creates the 1st folder correctly but then it has an error:
error “Finder got an error: The operation can’t be completed because there is already an item with that name.” number -48
Sorry, I should have used the Applescript command:
Here it is:
tell application "Finder"
set _excel to choose file
set _folder to choose folder
end tell
tell application "Microsoft Excel"
open _excel
set _surname to value of range "A1:A40" as list
set _firstname to value of range "B1:B40" as list
close active workbook
end tell
tell application "Finder"
repeat with _foldername in _surname
make new folder at folder _folder with properties {name:{(item 1 of _surname as text) & " " & (item 1 of _firstname as text)}}
end repeat
end tell
set _excel to choose file
set _folder to choose folder
tell application "Microsoft Excel"
open _excel
set theNames to value of range "A1:B40"
close active workbook
end tell
repeat with aName in theNames
set fullName to item 1 of aName & space & item 2 of aName
tell application "Finder" to make new folder at _folder with properties {name:fullName}
end repeat
If either the first name or the surname field is empty you might need a try block to catch the error