• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
slow repeat function with large folders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

slow repeat function with large folders


  • Subject: slow repeat function with large folders
  • From: Robert Poland <email@hidden>
  • Date: Sun, 17 Jun 2012 16:39:26 -0600

Hi,

With the following script is there a faster way to do the repeat function? It's slow with folders of 2500 items.

(*    set_Label_Index - 10/23/05 *)

-- NOTE: THIS SCRIPT MAY DEPEND ON THE SATIMAGE.OSAX

tell application "Finder"
set lionBugFixWin to make new Finder window -- Christopher Stone's Lion Bug Fix
close lionBugFixWin
try -- don't crash if nothing selected
set {selected_Items} to selection -- as alias list
end try
set theColorList to {"0-None", "1-Orange", "2-Red", "3-Yellow", "4-Blue", "5-Purple", "6-Green", "7-Gray"}
set selected_Items to selection --  as alias list


if selection = {} then -- there is no item(s) selected
tell me to activate
beep
set buttonReturned to display dialog "No selection was made." & return & "Do you wish to set ALL items to the same color?" as string buttons {"Yes", "No"} default button 1
set buttonReturned to button returned of buttonReturned
if buttonReturned = "Yes" then
tell application "System Events" to keystroke "a" using {command down} -- select all items
set selected_Items to selection -- get label index of first item
set colorchoice to (label index of item 1 of selected_Items) + 1 -- match different counting scheme
else
display dialog "User Cancelled" giving up after 1
return
end if
else if selection ≠ {} then -- there is an item(s) selected
set colorchoice to (label index of item 1 of selected_Items) + 1 -- match different counting schemes
end if
set theDefaultChoice to text item colorchoice of theColorList


-- get color selected
set theChoice to choose from list theColorList default items theDefaultChoice with title "Color Selection (set_Label_Index)" with prompt ("Use ENTER key to accept." & return & "Then press Option key down quickly to select entire folder.")
if theChoice is false then -- if theChoice is false (nothing selected) then return -- "User canceled."
return
end if


delay 1
set modKeys to do shell script (quoted form of "/Library/Application Support/getkeys")
if modKeys contains "option" then
set optionKeyDown to true as boolean
else
set optionKeyDown to false
end if


repeat with i from 1 to number of items in theColorList
if item i of theColorList is in theChoice then
set myLabelIndex to i - 1 -- match different counting schemes
exit repeat
end if
end repeat


if optionKeyDown then
set the label index of the front window's items to myLabelIndex
else
repeat with eachItem in (selected_Items)
set the label index of eachItem to myLabelIndex
end repeat
end if


select {} -- deselect selection(s), exit with nothing selected
beep
end tell

TIA,


Robert Poland - Fort Collins, CO



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Applescript launchers for UI events?
  • Next by Date: carbon copy cloner
  • Previous by thread: Re: Applescript launchers for UI events?
  • Next by thread: carbon copy cloner
  • Index(es):
    • Date
    • Thread