dim ae As AppleEvent
ae=newAppleEvent("misc", "slct", "MACS")
ae.folderitemparam("----") = app.gf
if not ae.send then
MsgBox "Finder not running."
else
ae = newAppleEvent("misc", "actv", "MACS") // the folderitem is not highlighted in its parent folder
'ae=newAppleEvent("misc", "mvis", "MACS") // the folderitem is not highlighted in its parent folder
if not ae.send then
MsgBox "Finder not running."
else
'MsgBox "Finder is running." // if this is uncommented the msgbox is displayed indicating "Finder is running."
ae.folderitemparam("----") = app.gf
'MsgBox app.gf.name // if this is uncommented the msgbox is displayed indicating the correct app.gf.name
end if
'app.gf.Parent.launch // if this is uncommented the correct app.gf.Parent is launched
end if
Any help/suggestions as to why the folderitem is not highlighted in its parent folder?
@Lennox Jacob OK, this works in Sierra and should also work in Mojave:
[code]const cocoa = “Cocoa.framework”
declare function NSClassFromString lib cocoa (name as CFStringRef) as Ptr
declare function sharedWorkspace lib cocoa selector “sharedWorkspace” (id as Ptr) as Ptr
declare function selectFile lib Cocoa selector “selectFile:inFileViewerRootedAtPath:” (id as Ptr, fullPath as CFStringRef, rootedAtPath as CFStringRef) as Boolean
dim ws as Ptr = NSClassFromString( “NSWorkspace” )
dim sws as Ptr = sharedWorkspace( ws )
dim path as String = “/full/path/to/file”
if NOT selectFile( sws, path, path ) then
beep //Error
end if[/code]