Xojo Conferences
XDCMay2019MiamiUSA

Need help with Apple Events (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Icon Advice
Next thread: Re: Capturing key pressed in Listbox


Re: why is carbon drawing sooo slow??   -   Charles Yeomans
  Need help with Apple Events   -   Jim McKay
   Re: Need help with Apple Events   -   Patrick Wynne
    Re: Need help with Apple Events   -   Jim McKay
    Need Help With Finder Selection   -   Jim McKay

Need help with Apple Events
Date: 03.08.01 01:36 (Thu, 2 Aug 2001 17:36:17 -0700)
From: Jim McKay
Hi all,
I'm trying to get an Apple Event to work with the finder. I'm
trying to find out the currently selected folderitem, but can't
seem to get the event to go through. The event is
'sele'(selection), core getd.. but nothing seems to work. I can do
it via applescript but would rather use AE..My bad code is..

ae = NewAppleEvent("core","getd","MACS")
obj=GetPropertyObjectDescriptor(nil, "sele")
ae.ObjectSpecifierParam("----") = obj
If Not ae.send() then
MsgBox "The event could not be sent."
else
'version = ae.replyRecord.FolderItemParam("----").name

if ae.ReplyRecord<>nil then
msgbox="replyrecord available" //this works
end if
if ae.replyDescList<>nil then
msgbox "desclistavail "+str(ae.replyDescList.Count) //count
is always 1
if ae.replydescList.folderItemItem(0)<>nil then
msgbox "folderitem available" //never true
end if
if ae.replyBoolean then
msgbox "successful" //never shows
end if
end if

end if

TIA
Jim M

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Need help with Apple Events
Date: 03.08.01 06:54 (Thu, 2 Aug 2001 22:54:09 -0700 (PDT))
From: Patrick Wynne
--- Jim McKay <<email address removed>> wrote:
> Hi all,
> I'm trying to get an Apple Event to work with the
> finder. I'm trying to find out the currently selected
> folderitem, but can't seem to get the event to go through. The
> event is 'sele'(selection), core getd.. but nothing seems to
> work. I can do it via applescript but would rather use AE..My
> bad code is..

Hi Jim,

Try this:

----- BEGIN CODE (watch for line wrap)

dim ae as AppleEvent
dim ff as FolderItem
dim obj as AppleEventObjectSpecifier
dim i, c as Integer

//create event
ae = NewAppleEvent("core", "getd", "MACS")
//create property object specifier
obj = GetPropertyObjectDescriptor(nil, "sele")
//set param
ae.ObjectSpecifierParam("----") = obj
//how do we want this data returned to us?
ae.MacTypeParam("rtyp") = "alis"
//send it...
if not ae.Send then
//uh oh...
msgbox "could not send"
else
//how many results did we get?
c = ae.ReplyDescList.Count
//loop thru results
for i = 1 to c
//add each result to the list box
listBox1.AddRow ae.ReplyDescList.FolderItemItem(i).AbsolutePath
next
end if

----- END CODE

This bit o' code fetches the Finder's selection and fills a list box
with their absolute paths.

HTH,

Patrick Wynne

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Need help with Apple Events
Date: 03.08.01 07:34 (Thu, 2 Aug 2001 23:34:24 -0700)
From: Jim McKay
Thanks VERY much! I've never been able to grasp AE concepts very well.

Jim M

On Thursday, August 2, 2001, at 10:54 PM, Patrick Wynne wrote:

> --- Jim McKay <<email address removed>> wrote:
>> Hi all,
>> I'm trying to get an Apple Event to work with the
>> finder. I'm trying to find out the currently selected
>> folderitem, but can't seem to get the event to go through. The
>> event is 'sele'(selection), core getd.. but nothing seems to
>> work. I can do it via applescript but would rather use AE..My
>> bad code is..
>
> Hi Jim,
>
> Try this:
>
> ----- BEGIN CODE (watch for line wrap)
>
> dim ae as AppleEvent
> dim ff as FolderItem
> dim obj as AppleEventObjectSpecifier
> dim i, c as Integer
>
> //create event
> ae = NewAppleEvent("core", "getd", "MACS")
> //create property object specifier
> obj = GetPropertyObjectDescriptor(nil, "sele")
> //set param
> ae.ObjectSpecifierParam("----") = obj
> //how do we want this data returned to us?
> ae.MacTypeParam("rtyp") = "alis"
> //send it...
> if not ae.Send then
> //uh oh...
> msgbox "could not send"
> else
> //how many results did we get?
> c = ae.ReplyDescList.Count
> //loop thru results
> for i = 1 to c
> //add each result to the list box
> listBox1.AddRow ae.ReplyDescList.FolderItemItem(i).AbsolutePath
> next
> end if
>
> ----- END CODE
>
> This bit o' code fetches the Finder's selection and fills a list box
> with their absolute paths.
>
> HTH,
>
> Patrick Wynne
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo!
> Messenger
> http://phonecard.yahoo.com/
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>