need help with applescript

Posted on
Wed Apr 03, 2013 9:37 am
catsgrant offline
Posts: 1
Joined: Apr 03, 2013

Re: need help with applescript

Hi henkjanvries & jay

Even though some time has passed the following may be of interest:

My AppleScript difficulties (EyeTV) were similar and it was your posts on this thread that has given me the answer to the problem.

Once AppleScript has the "raw" information from the EyeTV app ••• use a different app (I used Finder) to "refine" it.

This is because whoever programmed EyeTV for AppleScript has made the mistake of using "title" in a different way elsewhere in the AppleScript EyeTV dictionary.

My AppleScript below allows me to access copy or read anything from the Now & Next information of an EyeTV program. Use those parts of it to solve your problem.

CatsGrant

property the_path : (path to scripts folder as string) & "Applications:EyeTV:"
property newPrefsPath : the_path & "NowNext.txt"

tell application "EyeTV"
set programChannel to current channel of player_window playing as string
set programName to name of player_window playing
set programInfo to program info of player_window playing
end tell

tell application "Finder"
set currentStartTime to startTime of currentShow of programInfo as string
set currentEndTime to endTime of currentShow of programInfo as string
set currentTitle to title of currentShow of programInfo
set currentShortDescription to shortDescription of currentShow of programInfo
end tell

tell application "Finder"
set nextStartTime to startTime of nextShow of programInfo as string
set nextEndTime to endTime of nextShow of programInfo as string
set nextTitle to title of nextShow of programInfo
set nextShortDescription to shortDescription of nextShow of programInfo
end tell

tell application "Finder"
try
set fRef to missing value
set fRef to (open for access file newPrefsPath with write permission)
set eof fRef to 0
write programChannel & return & "•••" & return & programName & return & "•••" & return & currentStartTime & return & currentEndTime & return & currentTitle & return & currentShortDescription & return & "•••" & return & nextStartTime & return & nextEndTime & return & nextTitle & return & nextShortDescription to fRef
end try
if fRef is not missing value then close access fRef
end tell

tell application "TextEdit"
open alias newPrefsPath
end tell

return {programChannel, "•••", programName, "•••", currentStartTime, currentEndTime, currentTitle, currentShortDescription, "•••", nextStartTime, nextEndTime, nextTitle, nextShortDescription}

Who is online

Users browsing this forum: No registered users and 4 guests

cron