Welcome to MacForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

how to run applescript as a background process?

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  Compress Video to MPEG  
Author Message
anni

External


Since: Oct 13, 2008
Posts: 8



(Msg. 1) Posted: Mon Oct 13, 2008 10:39 pm
Post subject: how to run applescript as a background process?
Archived from groups: alt>comp>lang>applescript (more info?)

i want to run this script in background...

Actually i want to handle popup window which appear when we run this
code, it asks optons: 1-"Open the series" and 2-"Open the one", by
default the Open the one is selected but i wanted to select Opent the
series option. But this script wait until the option is not selected
so i was not able to run the code which select that option. Any
suggestion, how i can do it?

code to open event
********************************

[applescript]tell application "Microsoft Entourage"
set newevent to item 1 of (every event whose subject is equal
to
"Test")
open newevent
end tell[/applescript]

code to select option
**********************************
[applescript]activate application "Microsoft Entourage"
tell application "System Events"
tell process "Microsoft Entourage"
-- insert GUI Scripting statements here
--radio button "Open the series" of window 1
tell window 1
click radio button "Open the series"
end tell
end tell
end tell[/applescript]
***********************************

regards,
anni

 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Jo_y

External


Since: Jun 22, 2008
Posts: 30



(Msg. 2) Posted: Tue Nov 18, 2008 6:02 pm
Post subject: Re: how to run applescript as a background process? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You must save your script as "stay open" application, embedded into a
repeat- loop like this:

on idle
delay 5*minutes --5 min or delay 180 whose stays for 3 minutes
beep
--insert your script here
end idle

remenber that this particular type of application does not close
normally with "quit", but you quit it with the force-quit command,
manually: holding down command, alt and esc

 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Jerry Kindall

External


Since: Jul 09, 2003
Posts: 560



(Msg. 3) Posted: Tue Nov 18, 2008 9:29 pm
Post subject: Re: how to run applescript as a background process? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
,
Jo_y wrote:

> You must save your script as "stay open" application, embedded into a
> repeat- loop like this:
>
> on idle
> delay 5*minutes --5 min or delay 180 whose stays for 3 minutes
> beep
> --insert your script here
> end idle

It works better when you use return to do the delay.

on idle
beep
-- your script goes here
return 5 * minutes
end idle

> remenber that this particular type of application does not close
> normally with "quit", but you quit it with the force-quit command,
> manually: holding down command, alt and esc

Er, what? Quit works fine unless you happen to hit it while the
handler's running. This should be rare -- if it does happen, just try
again.

--
Jerry Kindall, Seattle, WA <http://www.jerrykindall.com/>

Send only plain text messages under 32K to the Reply-To address.
This mailbox is filtered aggressively to thwart spam and viruses.
 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Jo_y

External


Since: Jun 22, 2008
Posts: 30



(Msg. 4) Posted: Thu Nov 20, 2008 9:57 am
Post subject: Re: how to run applescript as a background process? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello Spencer,
The script i purpose is a application where stays open, with a idle
command and therefor the handler is running all the time, giving the
user no chance for quit the application process. It's very hard to get
the right timing, will say to find the right moment after and before
the delay, for execute the quit-action. :|
Return stays for delay too?
 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Jo_y

External


Since: Jun 22, 2008
Posts: 30



(Msg. 5) Posted: Thu Nov 20, 2008 10:03 am
Post subject: Re: how to run applescript as a background process? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello Spencer,
The script i purpose is a application where stays open, with a idle
command and therefor the handler is running all the time, giving the
user no chance for quit the application process. (if the user want to
quit the process whenever he or she want)

return 5 * minutes
-> stays for delay too?
 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Simon Slavin1

External


Since: May 16, 2004
Posts: 375



(Msg. 6) Posted: Sat Nov 22, 2008 6:26 pm
Post subject: Re: how to run applescript as a background process? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 20/11/2008, Jo_y wrote in message <2736d87a-dd41-444a-8308-
d439f8aec647 RemoveThis @v38g2000yqb.googlegroups.com>:

> return 5 * minutes
> -> stays for delay too?

To expand on Jerry's answer, you should not be trying to be using a
'delay' command yourself. The language knows that an 'on idle' look works
a particular way. So you use the structure like the following:


on idle

... do some things ...

return 180
end idle

The language runs the commands in the 'idle' handler, then it looks at the
number the 'idle' handler returned. Then the language waits that number
of seconds. Here it's 180 which is 3*60, so it will wait three minutes.
Then it calls the idle handler again, and it keeps going around and around
until it hits a 'quit' command.

You don't need to use any 'delay' commands yourself.

Simon.
--
http://www.hearsay.demon.co.uk
 >> Stay informed about: how to run applescript as a background process? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Getting a Process Identifier (PID) - Hi! I'm starting a new process (in background) as daemon, but I'm trying to take the PID of this process (to be able to kill it after). <code> set thePid to ((do shell script RunDirUnix & "myDaemon" & space & ConfigFile &amp...

Kill terminal (and process) - Quitting the terminal throws a dialog box saying this will terminate all processes and gives buttons to cancel or terminate. Is there a way to avoid this dialog (kind of like "saving no")? In lieu of that, is there a way to select the "ter...

New to Applescript - Hello, I'm brand new to Applescript - I've done a lot with VBS but never touched Applescript. Are there some good script repositories online? AppleScript Editors? Manuals? Any help will be greatly appreciated!!! TIA, Bill bill@2burkes.com

applescript studio read stdout from process live? - I want to update the output of a text box while reading from a UNIX process *LIVE* ( something like unzipping an archive for example ). I was thinking that I could somehow read from a named pipe using AppleScript's "open for access" handle in a...

Applescript RSS - Is there any way to acquire an RSS feed using Applescript? I'd like to be able to specify the RSS URL, then have Applescript consume the most recent 5 entries. Thanks, A
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]