PDA

View Full Version : Applescript and repeat?




marbo
Mar 30, 2009, 09:21 AM
Hello,

Can any one tell me how i print all information on this loop?

Its take sheculed program on eyetv.

Here is my code.

tell application "EyeTV"
set proglist to every program whose start time is greater than (current date)
set n to count of proglist
if n is 0 then
return "Ei ajastettuja ohjelmia."
else
repeat with po in proglist
return "Ajastettu: " & name of po & " " & start time of po
end repeat
end if
end tell


I hope some one can help me. And im sorry if my english is bad.



dydx
Mar 30, 2009, 10:12 AM
Marbo,

You can store the result of each iteration of the repeat-loop in a set, call it ListOfResults. Then return ListOfResults at the end of the program.

Consider the following implementation:

(* The list of television programs whose start time is greater than the current date and time (default: {} - the empty set). *)
set the ListOfResults to {}
tell application "EyeTV"
set proglist to every program whose start time is greater than (current date)
set n to count of proglist
if n is 0 then
return "Ei ajastettuja ohjelmia."
else
repeat with po in proglist
set entry to "Ajastettu: " & name of po & " " & start time of po
set the ListOfResults to the ListOfResults & entry as list
end repeat
end if
end tell
return the ListOfResults

marbo
Mar 30, 2009, 10:21 AM
Thanks, but now it i cant print with that info on my web page. :/

Oh, sorry its working :) Thank you.