FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Update Mediaplayer widget

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
-anonymous-
Guest





PostPosted: Sat Aug 19, 2006 8:24 pm    Post subject: Update Mediaplayer widget Reply with quote

I am writing my own scripts based around the mediaplayer widget as i want it to update the screen on the phone, just like the iTunes script, however my screen wont update automatically. Any ideas how to get it to update , i started with the Mediaplayer script and added to it.

Basically I am trying to answer this [url=http://www.salling.com/forums/viewtopic.php?t=2608&highlight=wiretap+pro]Post[/url]. And i would like it so the screen updates tell you the state, length of recording and the size of the recording. Currently it only updates each time you activate the script from the phone.

There is on limitation with the script due to a bug in wiretap pro, currently it can not pause the recording it can onlu unpuase the recording bt they are working on an update for this see [url=http://www.ambrosiasw.com/forums/index.php?showtopic=106193]here[/url]

[code:1]property repeatTimes : 1
property keymap_info : {{key_code:"1", key_title:"Record", key_description:"Start Recording/ Stop recording"}, {key_code:"2", key_title:"Stop", key_description:"Stop"}, {key_code:"3", key_title:"Pause", key_description:"Toggle Recording"}, {key_code:"5", key_title:"Quit", key_description:"Quit"}}
global thetime, theamount, thestate

using terms from application "SEC Helper"

on process invoke a_terminal
tell a_terminal
if my is_application_launched() then
my launch_widget(a_terminal)
else
tell a_terminal to push (make new question dialog with properties {textual content:"Launch Wiretap Pro?", name:"launcher"})
end if
end tell
end process invoke

on process dialog ok a_widget
if name of a_widget is "launcher" then
-- "ok to launch" dialog?
tell application "WireTap Pro" to launch
my launch_widget(terminal of a_widget)
end if
end process dialog ok

on update keypad the_keypad
end update keypad

on process screen exit the_screen

end process screen exit

on process key down the_key sent from the_keypad
set repeatTimes to 1
if the_key is "f" then
show keypad help keymap keymap_info title "WireTap Pro Help"
end if
return true -- make sure the keypad stays up (prevents stray returns value from above to pass)
end process key down

on process key repeat the_key sent from the_keypad

set repeatTimes to (repeatTimes + 1)
return true -- make sure the keypad stays up (prevents stray returns value from above to pass)
end process key repeat

on process key up the_key sent from the_keypad
if the_key is "1" then
my startrec()
end if
if the_key is "3" then
my pauserec()
end if
if the_key is "2" then
my stoprec()
end if
if the_key is "5" then
my quitrec()
end if
return true -- make sure the keypad stays up (prevents stray returns value from above to pass)
end process key up



on is_application_launched()
tell application "SEC Helper" to return check application availability "WireTap Pro"
end is_application_launched


on launch_widget(the_terminal)
tell the_terminal
set player to make new mediaplayer screen with properties {title:"WireTap Pro", name:"mediaplayer"}
tell player
my get_state()
if thestate is "idle" then
set artist_row to make new text row with properties {textual content:thestate, horizontal alignment:center, font size:large}
else if display size of the_terminal is small or display size of the_terminal is medium then
-- set playlist_row to missing value
set track_row to make new text row with properties {textual content:thestate, horizontal alignment:center, font size:large}
set album_row to make new text row with properties {textual content:thetime, horizontal alignment:center, font size:large}

set artist_row to make new text row with properties {textual content:theamount, horizontal alignment:center, font size:large}
else
--set playlist_row to make new text row with properties {horizontal alignment:left, overflow:clip, font size:small}
set track_row to make new text row with properties {textual content:thestate, horizontal alignment:center, font size:large}
set album_row to make new text row with properties {textual content:thetime, horizontal alignment:center, font size:large}

set artist_row to make new text row with properties {textual content:theamount, horizontal alignment:center, font size:large}
end if
end tell
push player
end tell
end launch_widget


on get_state()
tell application "WireTap Pro"
set thestate to current state as string
set thetime to time recorded & " Seconds" as string
if current state is Idle then
set thestate to current state as string
set thetime to time recorded & " Seconds" as string
else
set theamount to amount recorded / 1024 / 1024
set theamount to (round (theamount * 100)) / 100
set theamount to theamount & " mb" as string
-- set thetime to current state & return & time recorded & " Seconds" & return & theamount as string
end if
end tell
end get_state

end using terms from

on startrec()
tell application "WireTap Pro"
set recordinglist to {Idle, Paused}
set thestate to get current state

if thestate is Paused then
tell WireTap Pro "WireTap Pro" to pause recording
end if
if thestate is Idle then
tell WireTap Pro "WireTap Pro" to start recording
end if
end tell

end startrec

on pauserec()
tell application "WireTap Pro"
set thestate to get current state
if thestate is Paused then
tell WireTap Pro "WireTap Pro" to pause recording
end if
if thestate is Recording then
tell WireTap Pro "WireTap Pro" to pause recording
end if

end tell

end pauserec

on stoprec()
tell application "WireTap Pro"
set recordinglist to {Recording, Paused}
set thestate to get current state

if thestate is Paused then
tell WireTap Pro "WireTap Pro" to pause recording
tell WireTap Pro "WireTap Pro" to stop recording
end if
if thestate is Recording then
tell WireTap Pro "WireTap Pro" to stop recording
end if
end tell
end stoprec

on quitrec()
tell application "WireTap Pro"
set thestate to get current state as string


if thestate is "Idle" then
tell WireTap Pro "WireTap Pro" to quit
end if

if thestate is "Recording" then
stop recording
tell WireTap Pro "WireTap Pro" to quit
end if

if thestate is "Paused" then
tell WireTap Pro "WireTap Pro" to quit
end if

if thestate is "Converting" then
repeat until thestate is not "Converting"
delay 0.5
set thestate to get current state as string
end repeat
tell WireTap Pro "WireTap Pro" to quit
end if

if thestate is "Pending" then
repeat until thestate is not "Pending"
delay 0.5
set thestate to get current state as string
end repeat
tell WireTap Pro "WireTap Pro" to quit
end if
end tell
end quitrec[/code:1]
Back to top
Stormwolf
Newbie


Joined: 03 Sep 2006
Posts: 3

PostPosted: Sun Sep 03, 2006 7:51 pm    Post subject: Reply with quote

Taken from the Keypad Widget template:

[code:1]--- This handler is called (as per prefpane setting) repeatedly. Use it to update the
--- keypad object's properties to show current status of your script.
--- NOTE 1: Make sure your script behaves reasonably even if this handler is never called; the user
--- may have chosen to never idle-update the display (prefpane setting).
--- NOTE 2: This script handler *must* execute quite quickly.
--- NOTE 3: Setting the keypad text often will cause the battery to drain more quickly as there's more
--- Bluetooth activity and some devices will turn on backlighting when the display is updated.
on update keypad the_keypad
end update keypad[/code:1]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac 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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group