AppleEvent, ae, not sending

Hello,

This code displays the message box and launches Disk Utility but does not launch Disk Utility 's parent folder.

How can I fix that?


If NSWorkspace.ApplicationFile("Disk Utility") is nil or not NSWorkspace.ApplicationFile("Disk Utility").Exists then
  msgbox  "... not found "
  Return True
  
else
  msgbox  "Disk Utility is located in:" + EndOfLine.macOS + NSWorkspace.ApplicationFile("Disk Utility").shellPath
  NSWorkspace.ApplicationFile("Disk Utility").Launch
  
  dim ae As AppleEvent
  ae=newAppleEvent("misc","slct","MACS")
  
  ae.folderitemparam("----")=NSWorkspace.ApplicationFile("Disk Utility")
  if not ae.send then
    MsgBox "Finder not running."
  else
    MsgBox "ae not sending."
  end if
  
end if

Thanks.

Lennox

https://forum.xojo.com/51948-help-with-appleevent-please

Once you’ve figured out the security issues, there’s another issue with your code: you are using the outdated four-letter code for the Finder (“MACS”) in NewAppleEvent. Instead, use its bundle ID, which should be “com.apple.Finder”.

1 Like

Thanks, I will fix that.
Lennox