Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Operating System
Applescript troubleshooting
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="MacGrunt" data-source="post: 1276547" data-attributes="member: 210105"><p><strong>G'day</strong></p><p></p><p>I'm assuming you are trying to rename a bunch of files using one open excel spreadsheet as the source of the filenames — and that the new filenames are in column A (?)</p><p></p><p>[CODE]set theFiles to choose file with multiple selections allowed</p><p>set NewNames to {}</p><p></p><p>--place enough values from excel file into a list</p><p>tell application "Microsoft Excel"</p><p> tell active sheet of active workbook</p><p> repeat with x from 1 to count of theFiles</p><p> set end of NewNames to formula of cell ("A" & x)</p><p> end repeat</p><p> end tell</p><p>end tell</p><p>--rename the files</p><p>repeat with i from 1 to count of theFiles</p><p> set NewName to item i of NewNames</p><p> set ThisFile to item i of theFiles</p><p> tell application "Finder"</p><p> set name of ThisFile to (NewName & "." & name extension of ThisFile)</p><p> end tell</p><p>end repeat[/CODE]</p><p></p><p>i haven't tested what will happen if the script runs into an empty cell.</p><p></p><p>you could also run this as a droplet instead by changing it like this : </p><p>[CODE]on open theFiles</p><p> -- delete the following line</p><p> set theFiles to choose file with multiple selections allowed</p><p> --add the rest of the script</p><p>end open[/CODE]</p><p></p><p>hope that helps a little</p><p></p><p><strong>m.</strong></p></blockquote><p></p>
[QUOTE="MacGrunt, post: 1276547, member: 210105"] [B]G'day[/B] I'm assuming you are trying to rename a bunch of files using one open excel spreadsheet as the source of the filenames — and that the new filenames are in column A (?) [CODE]set theFiles to choose file with multiple selections allowed set NewNames to {} --place enough values from excel file into a list tell application "Microsoft Excel" tell active sheet of active workbook repeat with x from 1 to count of theFiles set end of NewNames to formula of cell ("A" & x) end repeat end tell end tell --rename the files repeat with i from 1 to count of theFiles set NewName to item i of NewNames set ThisFile to item i of theFiles tell application "Finder" set name of ThisFile to (NewName & "." & name extension of ThisFile) end tell end repeat[/CODE] i haven't tested what will happen if the script runs into an empty cell. you could also run this as a droplet instead by changing it like this : [CODE]on open theFiles -- delete the following line set theFiles to choose file with multiple selections allowed --add the rest of the script end open[/CODE] hope that helps a little [B]m.[/B] [/QUOTE]
Verification
Name this item. 🍎
Post reply
Forums
Apple Computing Products:
macOS - Operating System
Applescript troubleshooting
Top