Jump to content

Deleting Shortcuts does not refresh window


Recommended Posts

I having an issue when I use FileDelete to remove shortcuts from a folder. I am using a Windows toolbar and it is link to another folder shich I adding and deleting shortcuts. It seems the Explorer.exe has no issues when I create a shortcut with FileCreateShortcut, but seems to have issues when I remove them with FileDelete.

FileDelete("C:\Program Files\Xyloc\XSO\XsoToolBar\*.*")
FileCreateShortcut("C:\Program Files\Xyloc\XSO\Bin\XSOClient.exe",$xsotoolbar & "\"&"Logon"&".lnk",$cltfilepath,"UnknownUser","XSO Client Link","\\"&$ldapsvr&"\icons\"&"XylocBig.ico")

the results is the folder only has the last one I created, but the link Toolbar has the old ones and the new, If I manually delete the shortcuts from Windows the updates are instant, but if I use FileDelete("path\*.*") the toolbar does not remove them. Is there a better way to delete files and notify explorer to refresh the toolbar?

Thanks,

RogFleming

Link to comment
Share on other sites

  • 2 weeks later...

Well I did find and effect solution, It appear Windows will update the links in the toolbar if you change the attributes of the files from hidden to not hidden.

windows based Toolbar

Func CreateLaunchBar()

                    ;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

                    $ldapsvr=RegRead("HKLM\Software\Xyloc\XSO", "LdapServer")
                    Global $svrfilepath = "\\"&$ldapsvr&"\Apps\"
                    $SaveSet = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer","NoSaveSettings")
                    If $SaveSet <> 1 Then
                    SetSaveSettings(1) ; set the registry to not save settings at logoff
                    EndIf
                    SetSaveSettings(0)
EndFunc

Func SetSaveSettings($a)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer","NoSaveSettings","REG_DWORD",$a)
        ProcessClose("Explorer.exe")
        ProcessWaitClose("Explorer.exe")
        If $a = 0 then
        FileCreateShortcut("C:\Program Files\Xyloc\XSO\Bin\XSOClient.exe",$xsotoolbar & "\"&" Logon"&".lnk",$cltfilepath,"logon","Logon XSO Client","\\"&"C:\Program Files\Xyloc\XSO\Data\"&"XylocBig.ico")
        MsgBox(1,"Xyloc Sign-On","Installation is complete")
        Exit
        Else
        SetXSOToolbar()
        EndIf
EndFunc

Func SetXSOToolbar() ; imports the XSO toolbar registry settings
        Run("C:\WINDOWS\regedit.exe"&" "&"/s"&" "&"-s"&" "&"C:\Program Files\Xyloc\XSO\Data\"&"xsotoolbar.reg")
        ProcessClose("Explorer.exe")
        ProcessWaitClose("Explorer.exe")
EndFunc

Func XSOLogon($AD_USERNAME)
                FileCreateShortcut("C:\Program Files\Xyloc\XSO\Bin\XSOClient.exe",$xsotoolbar & "\"&" Logoff"&".lnk",$cltfilepath,"logoff","Logoff XSO Client","C:\Program Files\Xyloc\XSO\Data\"&"XylocBig.ico")
                FileSetAttrib($xsotoolbar&" Logoff"&".lnk","-H",0)
                _GetAppList()
                For $i = 1 To UBound($AppArray) -1
                    If FileExists($cltfilepath& "\"&$AppArray[$i]&".exe") Then
                        FileCreateShortcut($cltfilepath& "\"&$AppArray[$i]&".exe",$xsotoolbar & "\"&$AppArray[$i]&".lnk",$cltfilepath,$AD_USERNAME,$AppArray[$i]&" XSO Application","\\"&$ldapsvr&"\icons\"&$AppArray[$i]&".ico")
                        FileSetAttrib($xsotoolbar&"*.lnk","-H",0)
                    Else
                        FileCopy($svrfilepath&$AppArray[$i]&".exe",$cltfilepath)
                        FileCreateShortcut($cltfilepath& "\"&$AppArray[$i]&".exe",$xsotoolbar & "\"&$AppArray[$i]&".lnk",$cltfilepath,$AD_USERNAME,$AppArray[$i]&" XSO Application","\\"&$ldapsvr&"\icons\"&$AppArray[$i]&".ico")
                        FileSetAttrib($xsotoolbar&"*.lnk","-H",0)
                    EndIf
                Next
                FileSetAttrib($xsotoolbar&" Logon"&".lnk","+H",0)
                Exit
EndFunc

Func XSOLogoff()
                FileCreateShortcut("C:\Program Files\Xyloc\XSO\Bin\XSOClient.exe",$xsotoolbar & "\"&" Logon"&".lnk",$cltfilepath,"logon","Logon XSO Client","C:\Program Files\Xyloc\XSO\Data"&"XylocBig.ico")
                FileSetAttrib($xsotoolbar&"*.lnk","+H",0)
                FileSetAttrib($xsotoolbar&" Logon"&".lnk","-H",0)
                Exit
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...