• 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
choose from list re-visited - again
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

choose from list re-visited - again


  • Subject: choose from list re-visited - again
  • From: Robert Poland <email@hidden>
  • Date: Thu, 24 Apr 2008 11:12:46 -0600

Hi,

I have this script, below, that STILL won't work with Leopard (OS 10.5.2). I keep hoping that Apple will fix the (Leopard) Bug. But in the meantime has anyone come up with a work-around.

The line beginning with "set theChoice to" does not clear previous selection when selected by number.

global selection
set leopard to ((system attribute "sysv") ≥ 4175) -- ≥ 104F
set Tiger to ((system attribute "sysv") ≥ 4159) -- ≥ 103F
-- This is to bypass "Choose from List BUG"
-- set Leopard to false
-- set Tiger to false
set theDefaultList to {"none"}

tell application "Finder"
if exists Finder window 1 then -- make sure there is a window 
if selection is not {} then
set x to selection
set colorchoice to (label index of item 1 of x)
set colorchoice to colorchoice + 1
else
set colorchoice to 1 -- no selection, default to "none"
end if
else
tell application "System Events"
activate
beep
display dialog "There is no Finder Window" buttons "OK" default button 1 giving up after 4
return
end tell
end if
if Tiger or leopard then
(* 0 = none , 1 = orange, 2 = red, 3 = yellow, 4 = blue, 5 = purple, 6 = green, 7 = gray *)
set theColorList to {"1-none", "2-orange", "3-red", "4-yellow", "5-blue", "6-purple", "7-green", "8-gray"}
else
set theColorList to {"none", "orange", "red", "yellow", "blue", "purple", "green", "gray"}
end if
set theDefaultList to text item colorchoice of theColorList
set theChoice to (choose from list theColorList default items theDefaultList with title "Color Selection" with prompt "Option key to select entire folder.")
if (theChoice is false) then return -- "User canceled."
-- get color selected
set theDefaultList to text item colorchoice of theColorList
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
exit repeat
end if
end repeat
tell application "Extra Suites"
set optionKeyDown to (ES option down)
end tell
delay 1 -- Leopard needs a delay here
if optionKeyDown then
set the label index of the front window's items to myLabelIndex
else
repeat with eachItem in (x)
set the label index of eachItem to myLabelIndex
end repeat
end if
select {} -- deselect items
beep
end tell


Bob 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

  • Follow-Ups:
    • Re: choose from list re-visited - again
      • From: Philip Aker <email@hidden>
    • Re: choose from list re-visited - again
      • From: Christopher Nebel <email@hidden>
  • Prev by Date: Re: Frontmost Application Problem
  • Next by Date: Re: Choose File Limited by File Extension OR Type ???
  • Previous by thread: the odd case of the disappearing Eudora dictionary
  • Next by thread: Re: choose from list re-visited - again
  • Index(es):
    • Date
    • Thread