FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Little select song script for iTunes

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Salling Software Forums Forum Index -> Archives
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat May 03, 2003 8:43 pm    Post subject: Little select song script for iTunes Reply with quote

Hi my first time here on this board :)

In an earlier version of SEC there was no possibility to choose a
song from a list of songs of a list of playlists.

In version 1.5 its possible to have as many lists selected of a list
as you like to but you need to trick a little with the "on
item_was_selected(itemindex)" handler because this handler handels
all lists so you need to spare out some parts by using "if else"
branches to make it work.

neway this was my idea if someone has a better one please tell me.
The script isnīt coded quite qlean but it works for me.





-----here starts my script----------



my showPlaylists()
my generatePlaylistList()
property counter : 0
property trks : {}
property names : {}
set counter to 0
on showPlaylists()
try
set playListIndex to 1
try
tell application "iTunes"
set pli to index of current playlist
set playListIndex to pli
end tell
end try
tell application "SEC Helper"
enter list mode title "Select Playlist" items
(my generatePlaylistList()) selected item playListIndex
end tell
on error
beep
end try
end showPlaylists




on item_was_selected(itemIndex)
if counter is 0 then
try
tell application "iTunes"
set pl to item itemIndex of playlists

tell application "iTunes"
set trks to tracks of pl
end tell
set names to {}
repeat with trk in trks
set names to names & (name of
trk)
end repeat
tell application "SEC Helper"
enter list mode title "Select
Song" items names
end tell
end tell
end try
set counter to 1
else
try
tell application "iTunes"
set trk to (item itemIndex of trks)
play trk
end tell
on error
beep
end try
end if
end item_was_selected


on generatePlaylistList()
set playlistList to {}
tell application "iTunes"
repeat with pl in playlists
set playlistList to playlistList & (name of
pl)
end repeat
end tell
return playlistList
end generatePlaylistList

on menu_was_dismissed()
try
tell application "SEC Helper"
set counter to 0
end tell
end try
end menu_was_dismissed




--------END of script-----------------

(some new lines have to be removed)



Back to top
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Sat May 03, 2003 8:49 pm    Post subject: Re: Little select song script for iTunes Reply with quote

Glad to hear you're scripting with Clicker!

Your ingenious trick isn't necessary. Use the optional arguments to "enter
list mode":

item selected "item_was_selected"
menu dismissed "menu_was_dismissed"

This way, you can set the two lists to use different callbacks.

Let us know if you have any other questions.


best,
Jonas


On 03-05-03 20.42, "kaneda_tatsaki" wrote:

> Hi my first time here on this board :)
>
> In an earlier version of SEC there was no possibility to choose a
> song from a list of songs of a list of playlists.
>
> In version 1.5 its possible to have as many lists selected of a list
> as you like to but you need to trick a little with the "on
> item_was_selected(itemindex)" handler because this handler handels
> all lists so you need to spare out some parts by using "if else"
> branches to make it work.
>
> neway this was my idea if someone has a better one please tell me.
> The script isnīt coded quite qlean but it works for me.
>
>
>
>
>
> -----here starts my script----------
>
>
>
> my showPlaylists()
> my generatePlaylistList()
> property counter : 0
> property trks : {}
> property names : {}
> set counter to 0
> on showPlaylists()
> try
> set playListIndex to 1
> try
> tell application "iTunes"
> set pli to index of current playlist
> set playListIndex to pli
> end tell
> end try
> tell application "SEC Helper"
> enter list mode title "Select Playlist" items
> (my generatePlaylistList()) selected item playListIndex
> end tell
> on error
> beep
> end try
> end showPlaylists
>
>
>
>
> on item_was_selected(itemIndex)
> if counter is 0 then
> try
> tell application "iTunes"
> set pl to item itemIndex of playlists
>
> tell application "iTunes"
> set trks to tracks of pl
> end tell
> set names to {}
> repeat with trk in trks
> set names to names & (name of
> trk)
> end repeat
> tell application "SEC Helper"
> enter list mode title "Select
> Song" items names
> end tell
> end tell
> end try
> set counter to 1
> else
> try
> tell application "iTunes"
> set trk to (item itemIndex of trks)
> play trk
> end tell
> on error
> beep
> end try
> end if
> end item_was_selected
>
>
> on generatePlaylistList()
> set playlistList to {}
> tell application "iTunes"
> repeat with pl in playlists
> set playlistList to playlistList & (name of
> pl)
> end repeat
> end tell
> return playlistList
> end generatePlaylistList
>
> on menu_was_dismissed()
> try
> tell application "SEC Helper"
> set counter to 0
> end tell
> end try
> end menu_was_dismissed
>
>
>
>
> --------END of script-----------------
>
> (some new lines have to be removed)
>
>
>
>
> To unsubscribe from this group, send an email to:
> ericssonclient-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Sat May 03, 2003 9:06 pm    Post subject: Re: Little select song script for iTunes Reply with quote

Hi Mr salling Matthis Giesel here
thnx that was it what I didnīt know, first of all I thought that I
need to encapsulate it somehow but ... btw itīs your fault that I
startet to learn Apple script lol had no clue of scripting before
starting to play arround with SEC.

btw can you post an address where I can finaly send the money -
remember ?! had the prob with the non existing Credit Card :)

Iīve written some basic Apple scripts vor VLC if someone needs some
tell me.(when I say basic I mean basic :))




--- In ericssonclient@yahoogroups.com, Jonas Salling
wrote:
> Glad to hear you're scripting with Clicker!
>
> Your ingenious trick isn't necessary. Use the optional arguments
to "enter
> list mode":
>
> item selected "item_was_selected"
> menu dismissed "menu_was_dismissed"
>
> This way, you can set the two lists to use different callbacks.
>
> Let us know if you have any other questions.
>
>
> best,
> Jonas
>
>
> On 03-05-03 20.42, "kaneda_tatsaki" wrote:
>
> > Hi my first time here on this board :)
> >
> > In an earlier version of SEC there was no possibility to choose a
> > song from a list of songs of a list of playlists.
> >
> > In version 1.5 its possible to have as many lists selected of a
list
> > as you like to but you need to trick a little with the "on
> > item_was_selected(itemindex)" handler because this handler handels
> > all lists so you need to spare out some parts by using "if else"
> > branches to make it work.
> >
> > neway this was my idea if someone has a better one please tell me.
> > The script isnīt coded quite qlean but it works for me.
> >
> >
> >
> >
> >
> > -----here starts my script----------
> >
> >
> >
> > my showPlaylists()
> > my generatePlaylistList()
> > property counter : 0
> > property trks : {}
> > property names : {}
> > set counter to 0
> > on showPlaylists()
> > try
> > set playListIndex to 1
> > try
> > tell application "iTunes"
> > set pli to index of current playlist
> > set playListIndex to pli
> > end tell
> > end try
> > tell application "SEC Helper"
> > enter list mode title "Select Playlist" items
> > (my generatePlaylistList()) selected item playListIndex
> > end tell
> > on error
> > beep
> > end try
> > end showPlaylists
> >
> >
> >
> >
> > on item_was_selected(itemIndex)
> > if counter is 0 then
> > try
> > tell application "iTunes"
> > set pl to item itemIndex of playlists
> >
> > tell application "iTunes"
> > set trks to tracks of pl
> > end tell
> > set names to {}
> > repeat with trk in trks
> > set names to names & (name of
> > trk)
> > end repeat
> > tell application "SEC Helper"
> > enter list mode title "Select
> > Song" items names
> > end tell
> > end tell
> > end try
> > set counter to 1
> > else
> > try
> > tell application "iTunes"
> > set trk to (item itemIndex of trks)
> > play trk
> > end tell
> > on error
> > beep
> > end try
> > end if
> > end item_was_selected
> >
> >
> > on generatePlaylistList()
> > set playlistList to {}
> > tell application "iTunes"
> > repeat with pl in playlists
> > set playlistList to playlistList & (name of
> > pl)
> > end repeat
> > end tell
> > return playlistList
> > end generatePlaylistList
> >
> > on menu_was_dismissed()
> > try
> > tell application "SEC Helper"
> > set counter to 0
> > end tell
> > end try
> > end menu_was_dismissed
> >
> >
> >
> >
> > --------END of script-----------------
> >
> > (some new lines have to be removed)
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > ericssonclient-unsubscribe@yahoogroups.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >


Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Salling Software Forums Forum Index -> Archives All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group