Sign in to follow this  
Followers 0
Briandr

problem with pinning to start menu

1 post in this topic

#1 ·  Posted (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 by Briandr

Share this post


Link to post
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
Sign in to follow this  
Followers 0