Designating a Source Folder
Designating a Source Folder
- Subject: Designating a Source Folder
- From: Sean Malone <email@hidden>
- Date: Tue, 21 Aug 2001 20:44:41 -0700
Hello,
I'm new to the list and about 3 weeks into AppleScript. It's great stuff,
and having never programmed before, find the English-like qualities of it
very helpful...but I've run into a problem.
I've made a script that randomly plays 1 of 36 possible sound files. The
user is then presented with a dialog, they respond, and can either continue
or quit. I've got it working just fine on my computer, and now want to make
it usable on anyone else's computer. So, at the top, I made a reference to
the source folder of sound files...so far so good. But whenever I try to run
it, it keeps telling me that it can't either get the file, or that access is
denied. (I've tried several versions of the same command). To keep it short,
here's a version of the script with only two choices:
---------------
set folder_ref to choose folder with prompt "Designate the PITCHES folder"
tell play_pitches
run
end tell
script play_pitches
(random number from 1 to 2)
set numFile to the result
if numFile is 1 then
tell application "QuickTime Player"
(open file 1 of "folder_ref") play
end tell
display dialog "What is the Name of this Pitch?" with icon note ,
buttons {"Tell Me"} default button "Tell Me"
set response to button returned of the result
if response = "Tell Me" then display dialog ,
"The Pitch is A" buttons {"Cancel", "Next"} default button 2
if response = "Quit" then quit
tell play_pitches
run
end tell
end if
if numFile is 2 then
tell application "QuickTime Player"
(open file 2 of "folder_ref") play
end tell
display dialog "What is the Name of this Pitch?" with icon note ,
buttons {"Tell Me"} default button "Tell Me"
set response to button returned of the result
if response = "Tell Me" then display dialog,
"The Pitch is A" buttons {"Cancel", "Next"} default button 2
if response = "Quit" then quit
tell play_pitches
run
end tell
end if
end script
---------------------------
Can someone tell me how to properly set this up so it will work on someone
else's computer?
And, there's one other thing. There are 36 files to choose from, though
there are only 3 "different" kinds of files. What I mean by that is, there
are 3 of every correct answer. So, what I'd like to have it do, in order to
keep the script shorter, is:
If numFile is 1 or 2 or 3 etc.. (these would all generate the same correct
answer)
But the script doesn't work when I do that. What's the proper syntax for a
possible result being multiple items?
Thanks in advance,
Sean