Jump to content

Compiled script pinned on taskbar -> Started app get's a different tray entry


highend
 Share

Recommended Posts

Hi,

I've written a small script (that I compile afterwards) that will start my Chrome browser with a few settings read from a config file. No issues with it.

What I like to do is: If I pin my compiled Chrome_Portable.exe to the Windows 7 taskbar (manually by drag and drop the .exe to the correct place on the taskbar between a few other already pinned applications) it should open the Chrome browser tied to that pin instead of adding a normal tray entry for a "unrelated" Chrome app window. I hope I was able to describe it clearly enough :oops:

If I remove the Chrome_Portable.exe pin from the taskbar and create a link (.lnk) file that points to my .exe instead and pin that to the taskbar I have the exact same problem... Do I have to change the script and if yes, in which way?

Tia,

Highend

#NoTrayIcon
#Region
#AutoIt3Wrapper_Icon=Chrome_Portable.ico
#AutoIt3Wrapper_Outfile=Chrome_Portable.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion


; #SETTINGS =====================================================================================================================
Global $mainExe = "Chrome.exe"
Global $mainExePath = @ScriptDir & "Chrome"
Global $settingFile = @ScriptDir & ".Settings.txt"

; #MAIN PART# ===================================================================================================================
Local $file = FileOpen($settingFile, 0)
If $file = -1 Then
   MsgBox(0, "Chrome_Portable", ".Settings.txt file was not found!")
   Exit
EndIf
$file_content = FileRead($file)
FileClose($file)
$cmd_params = StringRegExpReplace($file_content, "rn", " ")
$cmd_params = StringReplace($cmd_params, "<curpath>", @ScriptDir)
ShellExecute($mainExePath & "Chrome.exe", $cmd_params & $CmdLineRaw)
Edited by highend
Link to comment
Share on other sites

I've changed the old ShellExecute line to:

ShellExecute($mainExePath & "Chrome.exe", " " & $cmd_params & $CmdLineRaw)

and I get:

the following message box (after placing your code before my ShellExecute line):

D:UsersHighendToolsChromeChromechrome.exe -user-data-dir="D:UsersHighendToolsChromeProfil" -enable-user-scripts -enable-extensions -enable-extension-toolstrips -disk-cache-size=1 -media-cache-size=1 ::-- "D:xampphtdocsindex.html"

Regards,

Highend

Edited by highend
Link to comment
Share on other sites

Good luck.

:oops: Interesting article. Unfortunately it doesn't provide autoit code :bye: Seems I have to change the strategy and create a script that reads the settings file, create a .lnk file with all parameters and pin that to the taskbar instead...

Link to comment
Share on other sites

I've wanted to do this too but I never got anywhere. It's looks like you need SHGetPropertyStoreForWindow (shouldn't be a problem) but I don't know how to deal with the IPropertyStore after that...

It's apparantly called Application User Model IDs too. Another article on it: Application User Model IDs (AppUserModelIDs)

Link to comment
Share on other sites

I've wanted to do this too but I never got anywhere.

All the effort for a rather simple task (imho). I've found a autohotkey library that allows ahk users to deal with these things but I like autoit and don't want to switch... I'm not sure if portable applications (that don't write their AppId into the registry) store their Id somewhere else or if it's possible to "read it out" of one of their windows. Like Google Chrome, when it is not installed but used in a portable manner.

Has anybody else tried to use the AppId to tie the windows of external applications (called via shellexecute, run, etc.) to the autoit taskbar pin?

Link to comment
Share on other sites

I'm not sure if this fits or not, but take a look at using iTaskBarList.

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

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...