Jump to content

Pin my program to Windows 8 TaskBar


Recommended Posts

Hello guys.

I have a little issue and I can't find any answer sadly so I'm opening this post.

I created a tool with AutoIt, but sadly on Windows 8.1 I can't pin it to my taskbar, I have no idea why. If I take any other program for example Firefox, when it's started and I do a right click on the icon in the taskbar I can have a nice menu and just below "Exit window" I have an option "Pin this program to the TaskBar" (or Unpin if already clicked), but with my AutoIt script (compiled) I have only the Exit button.

Do you know if there is a Windows option to add to GuiCtrlCreateGui() or anything I can do to be able to pin my program to the  windows 8.1 taskbar?

Thank you very much,

Tim

Edited by timmalos
Link to comment
Share on other sites

So the title needs fixing: Ping --> Pin
Please edit it else noone will get what you're talking about.

I don't have anything relevant to say on W8.1

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Fixed title sorry for the typo.

It's not an au3 file since it's compiled. I'm speaking of my .exe executable program.

Included a screenshot so that you can see I don't have any Pin option, only the Exit button. Am I the only one to have this issue on WIndows 8.1?

 

 

Sans titre.png

Edited by timmalos
Image
Link to comment
Share on other sites

You can right click the .exe file and pin it to the task bar, you can't do it using the program's icon on the task bar.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I may have found my issue, maybe not related to AutoIt I have to do more tests.

This program is located on a network drive R:\. If I copy it to my Desktop for example I can see the Pin option. So might be a Windows related issue with network drives. I'll try to find another way.

Anyway thanks guys for your help.

Edited by timmalos
Link to comment
Share on other sites

You can not pin programs that are on network drives or removable storage.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

It can be done like this on 8.1

#include-once
#include <WinAPI.au3>
#include <Constants.au3>

_PinToMenu('C:\Program Files (x86)\Internet Explorer\iexplore.exe', 'Task') ; Pin Item
;~ _PinToMenu('C:\Program Files\CCleaner\CCleaner.exe', 'Task', 0) ; Unpin Item

Func _PinToMenu($File, $Bar = 'Task', $Pin = True)
    If @OSBuild < 7600 Then Return SetError(1) ; Windows 7 only
    If Not FileExists($File) Then Return SetError(2)
    Local $sFolder = StringRegExpReplace($File, "(^.*\\)(.*)", "$1")
    Local $sFile = StringRegExpReplace($File, "^.*\\", '')
    $ObjShell = ObjCreate("Shell.Application")
    $objFolder = $ObjShell.Namespace($sFolder)
    $objFolderItem = $objFolder.ParseName($sFile)
    For $Val In $objFolderItem.Verbs()
        Select
            Case StringInStr($Bar, 'Task')
                If StringInStr($val(), "Tas&kBar") Then
                    $Val.DoIt()
                    Return
                EndIf
            Case StringInStr($Bar, 'Start')
                If StringInStr($val(), "Start Men&u") Then
                    $Val.DoIt()
                    Return
                EndIf
        EndSelect
    Next
EndFunc   ;==>_PinToMenu

Creds goto original poster, but i cant remember who it was

It will pin to start menu as well like this

_PinToMenu(@WindowsDir & '\notepad.exe', 'Start')

 

Edited by Chimaera
Link to comment
Share on other sites

its for a local machine and i use it for programs not apps ;)

you can access install folders for apps like this

http://www.wikihow.com/Access-Metro-Style-Apps-Installation-Folder-in-Windows-8

dunno if it helps though

Edited by Chimaera
Link to comment
Share on other sites

The code above this does not work for me for apps on usb or network drive.

You can not pin programs that are on networked drives, UNC paths, or on removable storage to the taskbar.

Just about the ONLY way to do it is to pin some other random program to the taskbar and then modify the shortcut to point to the networked location. It would be stupid to pin a program on removable storage to the taskbar, because if the drive isn't there, there's no program to run. Or if the drive letter changes it also won't run.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You can not pin programs that are on networked drives, UNC paths, or on removable storage to the taskbar.

Just about the ONLY way to do it is to pin some other random program to the taskbar and then modify the shortcut to point to the networked location. It would be stupid to pin a program on removable storage to the taskbar, because if the drive isn't there, there's no program to run. Or if the drive letter changes it also won't run.

Well, I kinda disagree with you on the "stupid thing" since at work most of us have a networked drive they use to access shared storage with some programs etc... Yes the drive letter can change (and yet I'm more subject to have my local disk dead than losing this networked drive on a SAN) and in this case it won't run, but you can delete a program in your local C:\ drive and it won't run either :) I don't see why Windows set this limitation. Anyway thanks for the tip with a random program, makes the work for me !

 

Link to comment
Share on other sites

I never said pinning a network program was stupid, I said pinning a program on a removable drive was. I frequently pin programs that are on UNC/Networked drives, I'd never do it for a program on removable storage

Perhaps "stupid" was too harsh a word, but at the very least it makes no sense to do it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 4 years later...

I know this topic has been dormant for quite a while but does anybody know why Chimaera's code only allows for the addition of four new taskbar pins? Any additional ones  will overwrite existing taskbar icons. Also, anybody have code to unpin the Windows store icon?  The following code

RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband","Favorites","REG_BINARY","0xFF")
RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband","FavoritesResolve")
processclose("explorer.exe")

will delete any existing pins including the Store but it thought there might be a more precise way to just eliminate the Store icon. Thanks in advance. 

Link to comment
Share on other sites

There is a verb to unpin a file from the task bar.  You must first check if it is available for the store icon.

Here the function to list all verbs available for a specific file :

#include <File.au3>
#include <Constants.au3>

_ListVerbs ("the full path of the file here")
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"Error", @error)

Func _ListVerbs($File)
  If @OSBuild < 7600 Then Return SetError(1)   ; Windows 7 only
  If Not FileExists($File) Then Return SetError(2)
  Local $sDrive, $sDir, $sFileName, $sExt
  _PathSplit($File, $sDrive, $sDir, $sFileName, $sExt)
  $ObjShell = ObjCreate("Shell.Application")
  $objFolder = $ObjShell.Namespace($sDrive & $sDir)
  $objFolderItem = $objFolder.ParseName($sFileName & $sExt)
  Local $sList
  For $Val In $objFolderItem.Verbs()
    $sList &= $Val.name & @CRLF
  Next
  MsgBox($MB_SYSTEMMODAL, "", $sList)
EndFunc   ;==>_ListVerbs

 

Link to comment
Share on other sites

After a few tests, I observed that Store is a bit different than a usual pin .exe.  So here is the code that will work on Win 10 :

#include <Constants.au3>

If @OSVersion <> "WIN_10" Then Exit MsgBox ($MB_SYSTEMMODAL,"Error","This function only works on Win 10")
_ListSoftwares()
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"Error", @error)
_SoftwareVerbs("Microsoft Store")
If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"Error", @error)

Func _ListSoftwares()
  $ObjShell = ObjCreate("Shell.Application")
  $objFolder = $ObjShell.Namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}')
  $objFolderItems = $objFolder.Items()
  For $oObj In $objFolderItems
    ConsoleWrite ($oObj.name & @CRLF)
  Next
EndFunc

Func _SoftwareVerbs($sSoftware, $sVerbToApply = "List")
  $ObjShell = ObjCreate("Shell.Application")
  $objFolder = $ObjShell.Namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}')
  If Not IsObj ($objFolder) Then Return SetError (1)
  $objFolderItems = $objFolder.Items ()
  Local $bFound = False, $sList
  For $oObj In $objFolderItems
    If $oObj.name = $sSoftware Then
      $bFound = True
      ExitLoop
    EndIf
  Next
  If Not $bFound Then Return SetError (2)
  For $oVerb in $oObj.Verbs ()
    If $sVerbToApply = "List" Then
      $sList &= $oVerb.Name & @CRLF
    ElseIf $oVerb.Name = $sVerbToApply Then
      $oVerb.DoIt ()
      Return
    EndIf
  Next
  If $sVerbToApply = "List" Then
    MsgBox ($MB_SYSTEMMODAL,"",$sList)
  Else
    Return SetError (3)
  EndIf
EndFunc

First, run the script to list the softwares and locate Store name.  Then run the verbs function to get a list of all actions available using Store name.  Then rerun verbs function by applying the exact unpin verb.

Edited by Nine
Link to comment
Share on other sites

  • 5 weeks later...

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

×
×
  • Create New...