• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can't Quit My Script ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't Quit My Script ?


  • Subject: Re: Can't Quit My Script ?
  • From: Andrew Oliver <email@hidden>
  • Date: Fri, 26 Mar 2004 22:27:27 -0800

In your script you're trapping the 'quit' event and performing your own
actions which happen *instead* of the normal quit, so your app never
actually quits.

The simple solution is to 'continue quit' after your actions so that the
normal app-level quit processes can occur:

on quit
-- user quit the script, so close all ssh connections
do shell script "killall ssh"
continue quit
end quit

Andrew
:)

On 3/26/04 9:42 PM, "Christopher Aloi" <email@hidden> wrote:

> Hello,
>
> I am new to this list, and also AP script, so thanks to all that help !!
>
> Here is what I am doing:
>
> I often travel with my Powerbook and use it on insecure wireless
> networks. I want to be able to check my email securely, without
> worrying about anyone grabbing a POP password. I know how to forward
> my POP email through a SSH tunnel, therefore encrypting my POP
> sessions. My goal is to have a script "Mail" that opens the SSH
> tunnel, launches my Mail.app, send and receives, when quit the app I
> want the tunnel to close also.
>
> I have the majority of the script is done, the problem is I have to
> force-quit the app (script) to close it.
>
> Here is the shell script my applescript is calling :
>
> ---
> #!/bin/sh
>
> ssh -L 1110:macinstyle.com:110 -l ctaloi -N macinstyle.com
>
> #end
> ----
>
> This works fine
>
> Next my AP Script:
>
> ----
> on run
> -- open the ssh tunnel
> display dialog "Opening SSH Tunnel To Mail Server"
> do shell script "/Users/chris/securemail.sh >/dev/null 2>&1 &"
> tell application "Mail"
> launch
> end tell
> end run
>
> on idle
> -- no need to do anything here, just return some value to keep the app
> alive
> return 60
>
> end idle
>
> on quit
> -- user quit the script, so close all ssh connections
> do shell script "killall ssh"
> end quit
> ----
>
> Everything works fine, I just can't quit the app !! When I choose quit,
> the tunnel closes ( I can watch using top ), but the app does not.
>
> Anyone have any thoughts ??
>
> Thanks !!
>
> -------------===---------------
> Christopher T. Aloi
> http://www.macinstyle.com
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Can't Quit My Script ? (From: Christopher Aloi <email@hidden>)

  • Prev by Date: Re: where to find pre-written scripts
  • Next by Date: Re: Can't Quit My Script ?
  • Previous by thread: Can't Quit My Script ?
  • Next by thread: Re: Can't Quit My Script ?
  • Index(es):
    • Date
    • Thread