• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: System Events Info
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events Info


  • Subject: Re: System Events Info
  • From: Emile Schwarz <email@hidden>
  • Date: Wed, 11 May 2005 10:14:31 +0200

1. There is some AppleScript pdf reference material available in Apple web sites. Thus they are old, good information can be found.


2. What about:

tell application "Finder"
	return name of every window
end tell

you get the name of every Finder open window. This is not what you want, but a start.

You can get the number of open windows using:

return count of window

or:

set OpenWindowCnt to count of window

then, using repeat and some other things...


WARNING: the path property disappears in Tiger (goes somewhere else if it is still here...), so:


	return path of front window

generates an error

	return target of front window as string

returns:

"Macintosh HD:AppleScript Working folder:"

Change the line where the check is done between the window file location (path) and "/Volumes/Dev" and you can be done.


I am sorry, but I can't spend more time on that.

Cheers,

Emile

tell application "Finder"
	-- init a variable
	set Idx to 1

	-- get the number of open windows
	set OpenWindowCnt to count of window

	-- process all of them, one at a time
	repeat OpenWindowCnt times
		-- get one window path
		set zePath to path of window Idx

		-- compare the path
		if text 1 thru 12 of zePath = "/Volumes/Dev" then
			-- the start match
			-- place here the code you want to execute
		else
			log zePath -- here you have a debug string
		end if

		-- inc the 'loop indice'
		set Idx to Idx + 1
	end repeat
	return count of window
	return target of every window as alias
end tell

email@hidden wrote:
From: Mark Thomas <email@hidden>
Subject: Re: System Events Info
To: Le Stang Jean-Baptiste <email@hidden>
Cc: email@hidden
Message-ID: <BEA6AD7E.11E88%email@hidden>
Content-Type: text/plain; charset="US-ASCII"

That does look good. I wish I knew this straight off, I'm not very good with
AppleScript as when I see the dictionary it just confuses me what I'm
suppose to do. Are there any good reference's for learning this language and
knowing what to do.

As this seems like the route to close a window. How would I get a list of
all window the finder has open, and then just close the ones which has a
path starting with "/Volumes/Dev". I have seen there is an attribute called
path, so I guess I can use that, but what about getting the list of open
windows and iterating them ??



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Help in creating a Start Up item in Panther
  • Next by Date: Re: Help in creating a Start Up item in Panther
  • Previous by thread: Re: System Events Info
  • Next by thread: Getting the full path of an applescript application
  • Index(es):
    • Date
    • Thread