• 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
Complex AppleEvent with RealBasic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Complex AppleEvent with RealBasic


  • Subject: Complex AppleEvent with RealBasic
  • From: Arnaud Nicolet <email@hidden>
  • Date: Mon, 30 Apr 2007 13:21:32 +0200

Hi,

I'm using RealBasic for programming. My problem has to do with AppleEvents so I ask here.

I'm trying to send the equivalent AppleEvent of this script:

set f to Choose File
Tell app "iTunes"
set c to Convert f --Convert the file f and returns the converted track
get location of c --Get the file of the track, i.e the converted file
end tell

I have no problem for the Choose File equivalent (it's built in Realbasic).

For the Convert function, I send an event (class="hook",ID="Conv") to iTunes. That works also (iTunes does the convert).

Now, I have a problem: I don't know how to get the result (c).

I know "get" is an AppleEvent (class="aevt",ID="getd") and "location" is the "pLoc" property of a track.

I can't figure how I must get the result and pass it to the "get" event.

If anyone is familiar with RealBasic, here's my actual code, which does not work:
dim ae As AppleEvent


ae=NewAppleEvent("hook","Conv","hook") 'Send to "hook" (aka iTunes) an "hook","Conv" AppleEvent
ae.FolderItemParam("----")=File 'The file to convert
ae.Timeout=99999
if not ae.Send then
Return 'iTunes is not running.
end if


  dim d As AppleEventDescList
  dim p As AppleEventObjectSpecifier

  d=ae.ReplyDescList

  dim ae2 As AppleEvent
  ae2=NewAppleEvent("aevt","getd","hook") 'get location of c

p=d.ObjectSpecifierItem(1) 'The result of the last AppleEvent is a DescList containing a list of tracks of the converted files.

'The target is the location (pLoc) of the result of the last AppleEvent:
  p=GetPropertyObjectDescriptor(p,"pLoc")
  ae2.ObjectSpecifierParam("----")=p
  if not ae2.Send then
	Return 'iTunes is not running.
  end if
  dim f As FolderItem=ae2.ReplyFolderItem
  Return f

Can anyone help?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Complex AppleEvent with RealBasic
      • From: Philip Aker <email@hidden>
  • Prev by Date: How do I get contents of a folder for renaming purposes?
  • Next by Date: Re: Complex AppleEvent with RealBasic
  • Previous by thread: Re: How do I get contents of a folder for renaming purposes?
  • Next by thread: Re: Complex AppleEvent with RealBasic
  • Index(es):
    • Date
    • Thread