Just fetched from macScripter.net
ell application "Finder"
try
if exists application file id "MSIE" then
set iePath to application file id "MSIE"
display dialog ("IE Located at: " & return & iePath & "") as string
end if
on error --> In case it's not found
display dialog "Couldn't find IE!"
end try
end tell
you can use it to find other apps as well, just change the creator code. AppleScript can be fun!
cheers
andre
On Aug 10, 2004, at 8:44 PM, Greg Hall wrote:
I recall from using RealBasic in the past that there is some AppleEvent
you can execute that locates a program based on its creator code. I think
there is some way to enter this into Script Editor, but I forget what the
command is.
This would enable you to find any copy of IE on the users system
regardless of where it is installed. In fact, the creator code is all you
need to tell the program what to do, if you're trying to control IE from
RR. Effectively, you don't actually know where the copy of IE is
installed, and you don't need to - you can launch and control it without
knowing where it is.
I don't know if it is possible just to detect the presence of IE, but is
possible to try the event that launches it, and if it fails, the user
doesn't have it.
Below is some code I used in RealBasic to launch Graphic Converter if it
isn't already running. One issue is that once you launch an app with an
AppleEvent, if you try to tell the app to do something before it has
finished launching, the event will fail. Unfortunately, there is no event
to find out if the app has finished launching.
What my code does is wait for GraphicConverter to launch by trying an
AppleEvent that reports how many windows GraphicConverter has open. This
event will fail unless GraphicConverter is finished loading an has
displayed its UI. So the program simply continuously tries executing the
AppleEvent until it is successful.
IE should support the same event for how many windows are open, so the idea shd work.
You would need to adapt this code for RR (I just started using RR yesterday, so I have no idea how it supports AppleEvents). This code is fairly low-level, in RealBasic you have to specify the event type and class and creator, so it may be hard to follow.
======================================== 'Wait for Finder to launch GC
ae = NewAppleEvent("aevt", "odoc", "MACS") obj = GetUniqueIDObjectDescriptor("appf", nil, "GKON") ae.ObjectSpecifierParam("----") = obj if not ae.Send then MsgBox "GraphicConverter is not available." Quit end if
'Wait until GC is able to report how many windows it has 'That way, we know it's ready for events
ae = NewAppleEvent("core", "getd", "GKON") obj = GetOrdinalObjectDescriptor("cwin", nil, "all ") ae.ObjectSpecifierParam("----") = obj while (not ae.Send) wend
'Bring myself to front. ae = NewAppleEvent("aevt", "odoc", "MACS") if DebugBuild then obj = GetUniqueIDObjectDescriptor("appf", nil, "RBv2") else obj = GetUniqueIDObjectDescriptor("appf", nil, "Bant") end if ae.ObjectSpecifierParam("----") = obj if not ae.Send then MsgBox "Unable to activate self." end if ========================================
Can anyone tell me if there's a way to detect on Mac OS X if IE is
installed,
via Revolution? Since the user could move IE to other locations on their
hard-drive, I can't really detect via file-path.
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution
================ Greg Hall [EMAIL PROTECTED] ================ _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
-- Andre Alves Garzia 2004 BRAZIL http://studio.soapdog.org
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution