Skip to content

Instantly share code, notes, and snippets.

@hissain
Created April 27, 2020 23:29
Show Gist options
  • Save hissain/421290e093c2c228918fb52643386219 to your computer and use it in GitHub Desktop.
Save hissain/421290e093c2c228918fb52643386219 to your computer and use it in GitHub Desktop.
set listWithLinks to {"google.com", "bing.com", "yahoo.com"}
set listWithLabels to {"Google", "Bing", "Yahoo"}
set dialogTitle to "Select & Go to open link"
set buttonOK to "Go"
set buttonCancel to "Cancel"
set choosedLabels to choose from list (listWithLabels as list) with title dialogTitle OK button name buttonOK cancel button name buttonCancel with multiple selections allowed
if false is choosedLabels then return
repeat with i from 1 to number of items in choosedLabels
set choosedLabel to item i of choosedLabels
repeat with i from 1 to number of items in listWithLabels
set lookupLabel to item i of listWithLabels
if choosedLabel is lookupLabel then
set link to item i of listWithLinks
open location "http://www." & link
end if
end repeat
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment