Re: Simple "value Class" problem that`s driving me crazy
Re: Simple "value Class" problem that`s driving me crazy
- Subject: Re: Simple "value Class" problem that`s driving me crazy
- From: Colin Stagner <email@hidden>
- Date: Sun, 4 Jan 2004 22:10:27 -0600
The "play" command requires that you give it a file specification, not
a string.
tell application "iTunes"
play (FilePath & SelectedSong) as alias
end tell
should work instead.
-Colin
On Jan 4, 2004, at 8:22 PM, Bruce wrote:
-Hello everyone. My name is Bruce and I am fairly new to AppleScript
and this is my first time posting to this user list, so please forgive
me if I don`t follow the correct procedures.
--This problem is driving me crazy. I`m positive it`s got something to
do with value classes but I can`t seem to work it out so here goes. I
want to use a dialog window in AppleScript to input a song`s name and
then get iTunes to play that song.
---------------------------------------------------------
--1)
set FilePath to "Main:SongFolder:"
-- Here I am setting the FilePath (the folder "SongFolder" on the disc
"Main") to the folder holding my song which for testing purposes I
will call "TestSong" (without the quotations of course.)
--2)
set DialogBox to display dialog "My Selection" default answer ""
buttons {"OK"} default button "OK"
--This is a crude dialog window into wich I enter my song`s name.
set SelectedSong to text returned of DialogBox
--3)
tell application "iTunes"
play FilePath & SelectedSong
end tell
---------------------------------------------------------
-- This seems so basic and yet it doesn`t work. (That`s what`s driving
me crazy.) You get an error message that says "AppleScript Error.
iTunes got an error: Can`t make some data into the expected type.
(That`s why I feel it has something to do with value classes.)
However, if I add the following before the tell application command,
it works fine:
--2.5)
if SelectedSong is "TestSong" then
set SelectedSong to "TestSong"
end if
-- This seems soooo redundant, and yet it works. Why? For one song
that`s ok, but for a whole list you have to repeat that "if section" a
thousand times and it obviously makes the script too long and ...too
redundant. Is there a simple command like "set SelectedSong to
SelectedSong of string" that I could do once to make it work no matter
what song I inputed? By the way, that "set...of string" command
doesn`t work. It was only an idea.
-- Any ideas would be GREATLY appreciated. Thanks for your time in
advance and I TRULY look forward to hearing from you soon.
-- Bruce Whitred
-- Follow Your Dreams
-- P.S. This letter was compiled using AppleScript
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.