hmmm... did I ask too many questions?
hmmm... did I ask too many questions?
- Subject: hmmm... did I ask too many questions?
- From: HR <email@hidden>
- Date: Thu, 06 Jun 2002 22:06:12 +0200
I was just wondering why I didn't get any feedback on my posting.
Maybe I disregarded some netiquette?
Should I have been more specific?
Less specific?
Should I have asked one q at a time?
Am I being off-topic?
Am I asking too stupid questions?
Did I misbehave in any other way?
Just let me know, would make me feel better.
--
Harald Rauser
email@hidden
------ Forwarded Message
From: HR <email@hidden>
Date: Sun, 02 Jun 2002 13:42:04 +0200
To: AppleScript-Users <email@hidden>
Subject: [Newbie Q] How to implement toggle switch?
I am working on a script that remote-controls Apple DVD Player under OS X.
It's supposed to be an AS Studio app when done. Being brand new to AS coding
(to coding in general, as a fact), I stumble over many problems.
The main script reads a Playlist text file, then plays all the titles in the
pre-defined order. The sample code below will give you an idea.
Now here are my problems:
1. sequential playing of titles - elegantly: how?
The necessary information handed over via the text file contains a row for
each title to be played, something like
{<Film Name>,<DVD Name>,<DVD Title number>, <Path to these DVD files>,
<playlist number>, [and maybe a few more...]}
...where <playlist number> has a value that determines the play order of the
playlist. This has been previously defined by the user in FM Pro, as I don't
know how to make it possible in AppleScript to assign and error-check a play
order under runtime....
A bit static, you need FMP, you have to export the text in the right sorted
order, and so on.
The ultimate solution would be to have a ASS interface that shows the titles
in window 1, then you determine the play order by dragging-and-dropping the
entries into window 2, but this I guess I will never manage :(
Now - how could I have only ONE piece of code that repeats itself for every
entry until the playlist has been played?
2. Play / Pause toggle button:
I want to give the script some interactivity, ie the user should be able to
- eg. pause the playlist and resume again from where he paused.
How could I establish a button that "toggles" this?
Ie, on the first click: obtain the current title, the DVD, and the elapsed
time -> then pause the DVD playback
on second click: go back to that particular title (or just resume play), and
make sure the main script continues from where it had stopped.
How to do that toggle, and where to put it in the script hierarchy so it
does not interfere with the play order and with the titles already played?
3. This is the hardest for me to figure out:
The text file provides, say, 10 rows with each row being a title to be
played. Now the user should be able to select any one of these titles and
make it play _more than one time_, somewhere in the playlist where the user
wants. Ie, I need to find a way of
a) somehow "doubling" this entry
b) shift this double instance around in the playlist during script
runtime...
Thanks in advance for any enlightenments!
------------------------------------------------------------
--------------- CODE EXAMPLE START--------------------------
(* read in tab-delim text file from a filemaker export for use as playlist*)
on ConvTabToArray(theText)
set oldTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set textLines to theText's text items
set AppleScript's text item delimiters to tab
set newArray to {}
repeat with eachLine in textLines
set newArray's end to eachLine's text items
end repeat
set AppleScript's text item delimiters to oldTID
newArray
end ConvTabToArray
set PlayListText to "[path to text file]" as alias (*select text source*)
set TookUpList to (read PlayListText as {text} using delimiter {return})
(* the read-in list is converted to an array*)
ConvTabToArray(TookUpList)
set PLArray to the result
set i to the number of items in PLArray
(*each line represents a title to be played, ist items provide the info as
to where the title is, the path, etc*)
set k to 0
repeat until k = i
set k to k + 1
log k
set CurrentTitle to item k of PLArray
set CurrentTitleName to item 2 of CurrentTitle
set CurrTitleNumber to item 5 of CurrentTitle
(* the items get extracted to variables*)
(* from here: testing the correct reading of parameters, script not finished
yet*)
display dialog (CurrentTitleName as string) & return & "Nummer: " &
CurrTitleNumber & return ,
& return & "Die laufende Nummer ist: " & k as string
end repeat
(*...........more code........*)
(* after all the relevant information has been obtained, the script calls
the different entries of the playlist, plays the corresponding title ith a
repeat loop that checks if the film title has ended, then goes on to the
next title. *)
set PathNow to "[a certain path]" as alias
tell application "DVD Player"
open VIDEO_TS of (PathNow)
set viewer visibility to true
set title to [variable of title]
play dvd
set LengthNow to title length
repeat until remaining time = (LengthNow - LengthNow)
end repeat
stop dvd
end tell
(* going to the next title*)
set PathNow to "[another certain path]" as alias
tell application "DVD Player"
open VIDEO_TS of (PathNow)
set title to [next variable of title]
play dvd
set LengthNow to title length
repeat until remaining time = (LengthNow - LengthNow)
end repeat
stop dvd
(* and so on *)
------------------------------------------------------------
--------------- CODE EXAMPLE END----------------------------
_______________________________________________
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.
------ End of Forwarded Message
_______________________________________________
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.