Re: assistance with script, part 2
Re: assistance with script, part 2
- Subject: Re: assistance with script, part 2
- From: Ross Hunter <email@hidden>
- Date: Tue, 11 Mar 2003 21:13:51 -0500
Andrew,
As I mentioned in an earlier post, I am _really_ new to writing
AppleScripts. I can do a bang up job with PageMaker and some basic
dBase programming. But AppleScripts are a new animal for me.
When this script runs I am not doing anything in the finder. It is
the startup folder to check for email when the computer starts itself
in the morning. I don't want it to run at other times when I start
the computer.
I value your suggestions and will give them a try.
I see that Michelle Steiner has a different way to get and use the
time. I guess there is more than one way to skin a cat.
set my_time to current date
set start_time to date (date string of my_time & " 6:55 am")
set end_time to date (date string of my_time & " 7:05 am")
Thanks for replying.
Ross Hunter
Orange, Virginia
............................................
On 3/11/03 4:06 PM, "Ross Hunter" <email@hidden> wrote:
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
...
Aaarrrggghhhh!
You do realize that when this script runs it will completely override
whatever you're doing in the Finder, opening windows and selecting files
regardless of whatever you might be doing at the time. Oh, and if you select
some other file or folder while the script is in progress, the script will
break, as it will do if you move the app to a different location.
In short, every single line of the above code is irrelevant, and can be
achieved with the single statement:
tell application ":Internet:Internet Applications:Eudora Application
Folder:Eudora" to activate
This code doesn't require the Finder's involvement, won't interfere with
whatever else you are doing in the Finder at the time, and doesn't open all
kinds of windows on your screen in the process.
You shouldn't try to get AppleScript to do things the WAY you'd do them
manually. Instead, think of WHAT you want to do (open the application)
rather than HOW you'd do it manually (open this folder, open that folder,
click on this icon, etc.)
As for why the script didn't run - it did exactly what it was told to
because today is Tuesday, March 11th and therefore after the end_time.
Instead, try using 'time of (current date) which will return the number of
seconds since midnight. You can then easily compare this to the required
start and end times by:
set start_time to (6 * hours + 55 * minutes) -- 24900
set end_time to (7 * hours + 5 + minutes) -- 25265
set my_time to time of (current date)
if (my_time > start_time) and (my_time < end_time) then
-- do something
end if
Andrew
:)
_______________________________________________
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.