Briandr Posted December 18, 2014 Share Posted December 18, 2014 (edited) Hi, Had similiar posting recently but as the problem changed I thought it might be best to start something fresh. If the problem was closely the same I'd keep the other topic going. Hope this is good posting behavior. Global Const $CSIDL_COMMON_PROGRAMS = 0x17 Global Const $CSIDL_PROGRAMS = 0x2 Global $objShell = ObjCreate("Shell.Application") Global $objAllUsersProgramsFolder = $objShell.NameSpace($CSIDL_COMMON_PROGRAMS) $strAllUsersProgramsPath = $objAllUsersProgramsFolder.Self.Path Global $objFolder = $objShell.Namespace($strAllUsersProgramsPath) Global $objFolderItem = $objFolder.ParseName("IP Address.lnk") Global $colVerbs = $objFolderItem.Verbs For $objVerb in $colVerbs If stringReplace($objVerb.name, "&", "") = "Pin to Start Menu" Then $objVerb.DoIt Next Global $objShell = ObjCreate("Shell.Application") Global $objAllUsersProgramsFolder = $objShell.NameSpace($CSIDL_COMMON_PROGRAMS) $strAllUsersProgramsPath = $objAllUsersProgramsFolder.Self.Path Global $objFolder = $objShell.Namespace($strAllUsersProgramsPath) Global $objFolderItem = $objFolder.ParseName("TeamViewer 9 Host.lnk") Global $colVerbs = $objFolderItem.Verbs For $objVerb in $colVerbs If stringReplace($objVerb.name, "&", "") = "Pin to Start Menu" Then $objVerb.DoIt Next Run(@ComSpec & " /c " & "Del " & '"' & @UserProfileDir & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\PinTVIPInfotoStartMenu.exe.lnk', "", @SW_HIDE) The last line which I struggled with for a while is working as it shold. The sections above that are not working. Those handling the pinning to the W7 start menu. Both shortcuts do exist off Start-->Programs so its not like I am trying to pin something that does not exist. Any ideas on how to change this so the pinning happens? What I am wondering is the code processing so fast it is skipping ahead and deleting the shortcut to the compiled AutoIT EXE before they have a chance to do what they need to do? Should I add in a sleep command. I will REM out the Run line and re-compile and see what happens. Help is much appreciated. Update: Pinning work correctly as long as the Run line is commented out. Edited December 18, 2014 by Briandr Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now