Re: assistance with script, part 2
Re: assistance with script, part 2
- Subject: Re: assistance with script, part 2
- From: Kai <email@hidden>
- Date: Wed, 12 Mar 2003 20:24:38 +0000
on Tue, 11 Mar 2003 19:06:30 -0500, Ross Hunter <email@hidden>
wrote:
>
set my_time to current date
>
set start_time to date "Monday, March 10, 2003 6:55:00 AM"
>
set end_time to date "Monday, March 10, 2003 7:05:00 AM"
>
if my_time is greater than start_time and my_time is less than end_time then
>
tell application "Finder"
>
activate
>
select startup disk
>
open selection
>
select folder "Internet" of startup disk
>
open selection
>
select file "Eudora" of folder "Eudora Application
>
Folder" of folder "Internet Applications" of folder "Internet" of
>
startup disk
>
open selection
>
tell application "Eudora"
>
connect with checking
>
end tell
>
end tell
>
end if
>
tell application "Finder"
>
return
>
end tell
>
-- disconnect PPP connection
Sorry Ross, I didn't notice/realise first time around that you were trying
to include a disconnect command within the commented lines.
If I remember correctly, the syntax should be:
==============
PPP disconnect
==============
However (again - if memory serves), should you be using AppleScript 1.5.5 /
Mac OS 9.1 (or later), I think you'll find that this may not work. Instead
of using any of the Remote Access Commands, you should use Network Setup
Scripting instead. (If you get a message like: "Could not find Apple Shared
Library Manager. Please make sure it is installed and try again." - then
that's also evidence that you need NSS.)
The other point I should make is this: If you want to include a disconnect
routine, then you probably shouldn't use the 'ignoring application
responses' that I suggested earlier. (If you do, I suspect you may find the
script trying to disconnect while Eudora is still doing its stuff.) So, to
avoid the timeout errors you mentioned, this is probably now a job for a
'with timeout' statement.
Here's a re-jigged version of my previous suggestion (which now includes a
disconnect routine) for you to try:
==============
set t to (current date)'s time
if t > 24900 and t < 25500 then
with timeout of 1000000 seconds
tell application "Eudora" to connect with checking
end timeout
tell application "Network Setup Scripting"
try -- (just a precaution in case the db should still be open)
close database
end try
open database
set c to Remote Access configurations whose active = true
disconnect c's item 1
close database
end tell
end if
==============
Again, no guarantees that it'll work correctly - but see how you get on...
I should like to add that it takes guts to post a script to this list when
you're just getting to grips with AppleScript. However, it usually helps
others here to get a better handle on exactly what you're trying to do - and
what may be going wrong. Infinitely preferable (IMO) to the "I'm trying to
do something and it doesn't work..." sort of comment.
Attempting to write ones own scripts (no matter what misunderstandings or
mistakes might take place along the way) still has to be one of the best
ways to learn about scripting. (And I should know about learning from
mistakes - I make enough of them!) ;-)
--
Kai
_______________________________________________
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.