Re: assistance with script, part 2
Re: assistance with script, part 2
- Subject: Re: assistance with script, part 2
- From: Andrew Oliver <email@hidden>
- Date: Tue, 11 Mar 2003 16:51:55 -0800
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.