1

I want to programmatically force Finder to refresh in Mountain Lion. In the previous version of OSX, the follow snippet works:

OSStatus    SendFinderSyncEvent( const FSRef* inObjectRef )
{
    AppleEvent  theEvent = { typeNull, NULL };
    AppleEvent  replyEvent = { typeNull, NULL };
    AliasHandle itemAlias = NULL;
    const OSType    kFinderSig = 'MACS';

OSStatus    err = FSNewAliasMinimal( inObjectRef, &itemAlias );
if (err == noErr)
{
    err = AEBuildAppleEvent( kAEFinderSuite, kAESync, typeApplSignature,
        &kFinderSig, sizeof(OSType), kAutoGenerateReturnID,
        kAnyTransactionID, &theEvent, NULL, "'----':alis(@@)", itemAlias );

    if (err == noErr)
    {
        err = AESendMessage( &theEvent, &replyEvent, kAENoReply,
            kAEDefaultTimeout );

        AEDisposeDesc( &replyEvent );
        AEDisposeDesc( &theEvent );
    }

    DisposeHandle( (Handle)itemAlias );
}

    return err;
}

Does anyone know of an alternative to do this on Mountain Lion? Thanks

Hien
  • 165
  • 2
  • 11
  • possible duplicate of [Finder update/refresh applescript not working in 10.8](http://stackoverflow.com/questions/11781373/finder-update-refresh-applescript-not-working-in-10-8) – Parag Bafna Mar 21 '13 at 06:55

1 Answers1

1

Its also not working for me.(Bud ID 12571746)
Apple needs to be aware there are lots of developers need this. File a bug report at http://bugreporter.apple.com -- it'll likely be closed as a duplicate, but every vote counts.

For refreshing finder window you can create and delete a file. Take a look at this post.

Community
  • 1
  • 1
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144