FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Creating widgets from "outside"

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


Joined: 12 Oct 2005
Posts: 10
Location: MIT

PostPosted: Mon Oct 17, 2005 5:12 am    Post subject: Creating widgets from "outside" Reply with quote

Jonas,
I'm disappointed that the "produce terminal squeal" doesnt seem to work with my phone (s710a). I would really like to use this feature. Which brings me to my next question: Is it possible to invoke clicker items via applescript from the host computer? Like push a text field widget onto the terminal without user interaction? For instance, I would like to have aol instant messenger run an applescript whenever I get an IM that pushes the message to a widget on my phone and somehow make it squeal or vibrate even. I was thinking maybe if you could force the phone into thinking it got a new text message then the phone would use its alert setting for that. (i figure this may be possible since bluephone elite seems to have access to text messages on the phone).
So far I've been able to use push persisent for simple things, but that doesn't allow me to respond. I was able to push a text field dialog onto the terminal as well with the text I wanted, but It not run from within the Clicker app, so It doesn't seem to listen after being run -- It doesnt respond when i try to hit ok or anything and I cant have that action invoke anything new.
So It seems like there ought to be a way via applescript to tell SEC Helper to activate a particular clicker script and treat it as if it were invoked from the phone itself. That would be an amazing feature and open the door to a large amount of new and interesting functionality.

Apologies for the long message,
Greg
Back to top
View user's profile Send private message Visit poster's website AIM Address
salling
Site Admin


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

PostPosted: Mon Oct 17, 2005 4:13 pm    Post subject: Reply with quote

Hi!

I'd like to introduce you to a new feature in Clicker 3.0... It is somewhat experimental, so please don't create something and post it on versiontracker quite yet, ok?

The "trick" to creating widgets that respond to user events *outside* of Clicker itself builds on two new things in Clicker 3.0's scripting dictionary:

1. The more solid object-oriented approach to message handlers. Shown as commands in Script Editor's dictionary view, but these are things you implement in your scripts. (see "process dialog ok", etc)

2. The member "delegate" in the widget base class. The type of this member is "script".

#2 is crucial for letting a script that is not run inside inject a script object responding to the events (#1) generated by the widget.

Here's a simple example:

Step 1: Define the delegate script to respond to events from a popup dialog widget

[code:1]
script my_dialog_handler
using terms from application "SEC Helper"
on process dialog ok the_dialog
show screen message "OK"
end process dialog ok
end using terms from
end script
[/code:1]

The name of this script object is "my_dialog_handler" and we're going to pass it to the widget, so it knows who's to handle its events.

Step 2: Create the popup dialog widget

[code:1]
tell application "SEC Helper"
tell current terminal
push (make new popup dialog with properties {textual content:"Yeah?", delegate:my_dialog_handler})
end tell
end tell
[/code:1]


To try this, enter the whole thing in Script Editor:

[code:1]
script my_dialog_handler
using terms from application "SEC Helper"
on process dialog ok the_dialog
show screen message "OK"
end process dialog ok
end using terms from
end script


tell application "SEC Helper"
tell current terminal
push (make new popup dialog with properties {textual content:"Yeah?", delegate:my_dialog_handler})
end tell
end tell
[/code:1]


Connect to your phone (if yours is a phone with our client application on it, the client must be open). Run the script. Nifty, eh?

It's super-easy to use this to get notifications on the phone when there's an incoming email, etc.

I hope you'll have fun with this.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
salling
Site Admin


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

PostPosted: Mon Oct 17, 2005 4:40 pm    Post subject: Reply with quote

Here, btw, is more info on script objects in Apple's developer documentation:

http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScriptLangGuide/AppleScript.f0.html

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sarge
Junior Member


Joined: 06 Mar 2005
Posts: 29
Location: Manchester, England

PostPosted: Mon Oct 17, 2005 6:26 pm    Post subject: GMail notifier -> Phone Reply with quote

Dear All,

After using Jonas' useful code in this forum, along with some other code from the "Find My Device" tool in 2.2.1, I've made a crude GMail Notifier -> Phone Alert. In order to use this tool, simply unzip the file to the
Library/Application Support/GMail Notifier and it will tell you with a beep "You've got GMail". If people want to refine the code further then that would be great, as cutting and posting/editing is the limit of my AppleScript knowledge at the moment - but I'm learning!!

Regards,

Nik

[b] You must download the OFFICIAL Gmail notifier from google for this to work! [/b]


Last edited by sarge on Tue Oct 18, 2005 10:28 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
highgearengineer
Newbie


Joined: 12 Oct 2005
Posts: 10
Location: MIT

PostPosted: Tue Oct 18, 2005 12:45 am    Post subject: Reply with quote

This is amazing
Back to top
View user's profile Send private message Visit poster's website AIM Address
ola_h
Newbie


Joined: 25 Oct 2005
Posts: 4

PostPosted: Tue Oct 25, 2005 9:42 pm    Post subject: Reply with quote

Did not work until I restarted GMail Noifier


"To install, simply copy the script (plugin) to Library/Application Support/Gmail Notifier (create the directory if it doesn't exist), and restart the Gmail Notifier."

http://googleblog.blogspot.com/2005/09/extras-for-your-mac-gmail-notifier.html
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