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
macOS & iOS Developer Playground
macOS - Development and Darwin
Run the applescript on multiple folders at a time ?
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="Mark FX" data-source="post: 1735810" data-attributes="member: 211556"><p>You haven't explained how you getting the input to your on run handler, so I'll assume your trying to create a dropplet application.</p><p>In which case you need an on open handler to process dropped system files or folders.</p><p></p><p>Here's a very basic simple example, using a repeat loop to process each dropped item.</p><p></p><p>[CODE]</p><p>on open theDroppedItems</p><p> repeat with i from 1 to count of theDroppedItems</p><p> try</p><p> set theItem to item i of theDroppedItems</p><p> set theItemInfo to info for theItem</p><p> display dialog "Name of the dropped file system item is " & name of theItemInfo</p><p> on error</p><p> display alert "Error occured with the dropped file system items." as warning giving up after 30</p><p> exit repeat</p><p> end try</p><p> end repeat</p><p>end open</p><p>[/CODE]</p><p></p><p>Paste the above code into a new Script Editor file, and save it to your Desktop as an Application file, and not as a Script file.</p><p>Then drag multiple files or folders from Finder to the new Desktop application icon on your Desktop, and see it loop thropugh each item.</p><p></p><p>Hope this is the kind of thing you were after.</p><p></p><p>If your not creating a dropplet, but an AppleScript application with the ability to select different folders for processing it's contained files, then the answer is similar, simply use a repeat loop to process each folder in turn.</p><p></p><p>Regards Mark</p></blockquote><p></p>
[QUOTE="Mark FX, post: 1735810, member: 211556"] You haven't explained how you getting the input to your on run handler, so I'll assume your trying to create a dropplet application. In which case you need an on open handler to process dropped system files or folders. Here's a very basic simple example, using a repeat loop to process each dropped item. [CODE] on open theDroppedItems repeat with i from 1 to count of theDroppedItems try set theItem to item i of theDroppedItems set theItemInfo to info for theItem display dialog "Name of the dropped file system item is " & name of theItemInfo on error display alert "Error occured with the dropped file system items." as warning giving up after 30 exit repeat end try end repeat end open [/CODE] Paste the above code into a new Script Editor file, and save it to your Desktop as an Application file, and not as a Script file. Then drag multiple files or folders from Finder to the new Desktop application icon on your Desktop, and see it loop thropugh each item. Hope this is the kind of thing you were after. If your not creating a dropplet, but an AppleScript application with the ability to select different folders for processing it's contained files, then the answer is similar, simply use a repeat loop to process each folder in turn. Regards Mark [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Run the applescript on multiple folders at a time ?
Top