on click on handler + Internet Connect app

Hi all! I have this app that logs time connected to the internet every session and it quits once I disconnect from the top-right menu (if you have it, if not, it’s in System Preferences – > Network → Show: Internal Modem (or whatever you have) → Modem). The app is stay open and an idle handler keeps updating the seconds connected. Then when I disconnect it saves some data and quits. So far all that works ok, but I would like to add one more feature: when “idle”, is there a way I could click on the icon in the dock and that the app will show me a dialog or do something?
Something like “on click” → action

So far that’s it. If anyone’s interested I’ll post the code, it’s large, and in spanish (variable names and comments of course) but it’s working pretty nice, I’m very proud. you’d have to change the function that calculates the money spent on the call (which is actually not applyable to the US since those are local calls, hence free as far as I know, but for us the third-worlders hehe it might be useful, it helps controling oneself). And I have an iTunes timer that’s pretty cool too. It plays for a while (you set xx songs chosen from a certain playlist) and then shuts down or sleeps. It’s nice, but off topic!! Oks, I thank anyone who helps! :wink:

Hi,

Yes, you can do this. You need a reopen run handler. Here’s a simple example:

on run
display dialog “hi”
end run
on reopen
display dialog “You clicked?”
run
end reopen
on idle
beep 1
return 3
end idle

Edit: and take out the ‘run’ from the reopen handler if you want to jump to the idle handler instead of the run handler.

gl,

That should be very useful!! Thanks a lot!

I’ll post the code once I’ve made the changes. Maybe somebody can tell me if it worked ok from startes or if many changes were needed! I’d be very interested in knowing!

(I’ll probably post it here too, besides Code Exchange)

Hi Nikel,

You’re welcome. Hope it works out.

gl,

I saved that as testing.app and it works but if i try to activate reopen using this, it dont do anything:

tell application "Finder" to reopen "Macintosh HD:Users:cirno:Desktop:testing.app"