Re: Subject: How do I script "Hide Toolbar" in Finder
Re: Subject: How do I script "Hide Toolbar" in Finder
- Subject: Re: Subject: How do I script "Hide Toolbar" in Finder
- From: Andrew Oliver <email@hidden>
- Date: Wed, 19 Feb 2003 12:24:14 -0800
Sure you can.
Even though I can't believe I'm proposing this... when the toolbar is
visible, the Finder's View menu includes a 'Hide Toolbar' option.
When the toolbar is not visible, the menu item changes to 'Show Toolbar'
In pseudo-code
-- to toggle toolbar
try
select menu 'show toolbar'
on error
-- oops, toolbar's already shown, so hide it
select menu 'hide toolbar'
end try
<rant>
Sorry for the pseudo code and not real AppleScript, but I'm patently opposed
to GUI scripting as a lame-ass excuse for properly event-enabled
applications.
While GUI scripting does offer a work around to this issue, the fact remains
that the toolbar should be a property of the Finder window and accessible as
such.
In addition, and more importantly, GUI scripting too often leads to poor
AppleScript implementation by users who try to use it to emulate user
actions rather than directly manipulating the objects at hand. For example:
tell application "myapp"
do menu item "Save" of menu "File" of menu bar 1
end tell
Instead of tell application "myapp" to save document 1
A classic example of what's wrong with GUI scripting is Apple's own
http://www.apple.com/applescript/GUI/#1001 which shows you how to select the
'Clean Up' menu item in the Finder.
IMHO, this should NEVER be done because
a) the code is NOT portable (there is no "Clean Up" menu item in the French
OS, or the Japanese one, or most other internationalized versions of the
Finder),
b) the menu item changes depending on whether there's something selected or
not ("Clean up selection"), so the code will fail, and
c) there is a specific Apple Event for 'clean up' in the Finder's dictionary
(although this doesn't work, which further illustrates my earlier point
about properly event-enabled applications)
<rant>
On 2/19/03 11:28 AM, "Paul Skinner" <email@hidden> wrote:
>
On Wednesday, February 19, 2003, at 12:33 PM, David Crowe wrote:
>
>
> Note that the Applescript at:
>
>
>
> http://www.apple.com/applescript/GUI/#1004
>
>
>
>
>
> does NOT hide the toolbar it Toggles the toolbar. If it is already
>
> invisible, it makes it visible again.
>
>
>
> Perhaps someone knows how to hide the toolbar (or do nothing if it is
>
> already hidden)?
>
>
>
> - David Crowe
>
>
As far as GUI scripting goes. You can't tell if this element (the
>
toolbar) is visible or hidden. It's attributes are not modified when it
>
is altered by hand or by script.
>
Maybe ... nah ... Just wait for 10.3 and see if they wire it up.
>
--
>
Paul Skinner
>
>
Only Irish coffee provides in a single glass all four essential food
>
groups: alcohol, caffeine, sugar, and fat.
>
--Alex Levine
>
_______________________________________________
>
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.