AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AutoHotkey Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 11 Feb 2015, 12:52

DutchPete wrote:I have only 1 instance of MultiStart & that is in C:\Users\user\Scripts\AHK\Startup. I don't know how it can be in C:\Users\user\Scripts\AHK\*.exe since the exe bit is not a folder. I never added any exe to any of my AHK scripts; the only one that has it is MultiStart & only because i copied it from your original script.
Be that as it may, I don't think it is possible to resolve the issue this way, so I will give up & just stay with all the individual scripts' shortcuts in the start-up folder.
Many thanks for your support & time. I hope we can still work together in future :)
It sounds like the problem is exactly what I said.

You have a copy of MultiStart in your Startup folder. Then when MultiStart runs, you have a path to run everything in the Startup folder, which causes the first instance of MultiStart to run everything in the Startup folder, which runs another instance of MultiStart, which then runs everything in the Startup folder, over and over.

The number of instances of a program running has nothing to do with how many times you have it in folders. I only have notepad.exe in one place on my computer but I can start that program over and over and have 10 instances of notepad.exe running at the same time.

This script is designed to run other scripts but one of the other scripts it runs cannot be another instance of itself which is what is happening when you tell it to run everything in the folder it is in.

You need to remove the line:
"C:\Users\user\Scripts\AHK\Startup\"

There is no need to have this script run everything in the Startup folder. That is done automatically by Windows when your computer boots up.

Rereading your post it sounds like you don't even need the Startup or Compiled Scripts paths, those were just examples in my script of path names. Not paths that you need for you.

You need to delete everything between:
(Join,


)]

And put only the paths that you want.

Everything between those two lines in my script are only examples.
All of these are only example of paths and how they are formatted:

Code: Select all

"C:\Users\Guru\Documents\AutoHotkey\Startup\"
"C:\Users\Guru\Documents\AutoHotkey\Compiled Scripts\*.exe"
A_MyDocuments "\AutoHotkey\My Scripts\Hotstring Helper.ahk"
"C:\Users\Guru\Documents\AutoHotkey\My Scripts\Calculator.ahk"
".\Web\Google Search.ahk"
"..\Dictionary.ahk"
"Hotkey Help.ahk"
"MediaMonkey.ahk"
These are not paths I would expect anyone else to use. They are examples to be edited by the user.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

DutchPete

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by DutchPete » 11 Feb 2015, 13:26

You give 3 instructions:
* remove "C:\Users\user\Scripts\AHK\Startup\"
* delete everything between:
(Join,


)]
* put only the paths that you want

I have implemented the 1st one & tried to make sense of 2 & 3, so the relevant portion of my script now looks like this:

; INITIALIZATION - VARIABLES
;{-----------------------------------------------
;
Files := [ ; Additional Startup Files and Folders Can Be Added Between the ( Continuations ) Below
(Join,
"C:\Users\user\Scripts\AHK\*.exe"
"C:\Users\user\Scripts\AHK\breakfast.ahk"
"C:\Users\user\Scripts\AHK\date.ahk"
"C:\Users\user\Scripts\AHK\é.ahk"
"C:\Users\user\Scripts\AHK\folders.ahk"
"C:\Users\user\Scripts\AHK\gra.ahk"
"C:\Users\user\Scripts\AHK\insertkeyreplacement.ahk"
"C:\Users\user\Scripts\AHK\journaldate.ahk"
"C:\Users\user\Scripts\AHK\markets.ahk"
"C:\Users\user\Scripts\AHK\mc.ahk"
"C:\Users\user\Scripts\AHK\salad.ahk"
"C:\Users\user\Scripts\AHK\skitch.ahk"
"C:\Users\user\Scripts\AHK\yog.ahk"
)]
;}

Is that OK? Note that I have deleted the "compiled scripts folder & have put everything (except MultiStart) in the AHK folder.

User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 12 Feb 2015, 13:30

DutchPete wrote:You give 3 instructions:
* remove "C:\Users\user\Scripts\AHK\Startup\"
* delete everything between:
(Join,


)]
* put only the paths that you want

I have implemented the 1st one & tried to make sense of 2 & 3, so the relevant portion of my script now looks like this:

; INITIALIZATION - VARIABLES
;{-----------------------------------------------
;
Files := [ ; Additional Startup Files and Folders Can Be Added Between the ( Continuations ) Below
(Join,
"C:\Users\user\Scripts\AHK\*.exe"
"C:\Users\user\Scripts\AHK\breakfast.ahk"
"C:\Users\user\Scripts\AHK\date.ahk"
"C:\Users\user\Scripts\AHK\é.ahk"
"C:\Users\user\Scripts\AHK\folders.ahk"
"C:\Users\user\Scripts\AHK\gra.ahk"
"C:\Users\user\Scripts\AHK\insertkeyreplacement.ahk"
"C:\Users\user\Scripts\AHK\journaldate.ahk"
"C:\Users\user\Scripts\AHK\markets.ahk"
"C:\Users\user\Scripts\AHK\mc.ahk"
"C:\Users\user\Scripts\AHK\salad.ahk"
"C:\Users\user\Scripts\AHK\skitch.ahk"
"C:\Users\user\Scripts\AHK\yog.ahk"
)]
;}

Is that OK? Note that I have deleted the "compiled scripts folder & have put everything (except MultiStart) in the AHK folder.
Are you sure you need this:
"C:\Users\user\Scripts\AHK\*.exe"

That line will cause to be run every file with the "exe" extension in the AHK folder. I thought you said you did not compile any of your scripts into exe files. You just need to make sure that you actually want to run all the exe files in your AHK folder. If not then you can remove that line.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

DutchPete

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by DutchPete » 13 Feb 2015, 06:02

Yes, that did the trick !! I must have misunderstood you because I queried the presence of that line on the 10 Feb (bottom of page 3). Anyway, deleting it cleaned up the script which now works fine :bravo:
Many, many thanks for your patience, I am impressed that you did not give up.

User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by KilliK » 14 Apr 2016, 12:31

sorry to bring this up, but I am encountering a problem with your script.
I set a custom folder to load of bunch of my scripts from there. It loads them fine but it doesnt hide their tray icons, apart from one randomly. I have set systray from Windows to show the ahk icons and tried to refresh them by moving my mouse over the systray but they just dont hide.
is this a bug or something that I must set in my scripts first?
I am using the latest version of AHK and Windows 10 Pro x64

User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 14 Apr 2016, 15:41

Updated Script on First Page

Change Log (2016-04-14):
Updated TrayIcon functions to work better with Windows 10

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 14 Apr 2016, 15:47

KilliK wrote:sorry to bring this up, but I am encountering a problem with your script.
I set a custom folder to load of bunch of my scripts from there. It loads them fine but it doesnt hide their tray icons, apart from one randomly. I have set systray from Windows to show the ahk icons and tried to refresh them by moving my mouse over the systray but they just dont hide.
is this a bug or something that I must set in my scripts first?
I am using the latest version of AHK and Windows 10 Pro x64
The TrayIcon Library that AHK Startup uses to hide the tray icons does not work properly with Windows 10. I have updated the library. I may not have corrected every function in the library to work with Windows 10 but I did corrected the three functions required to hide tray icons to work correctly with Windows 10.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

nathan323
Posts: 44
Joined: 31 Jan 2016, 02:53
Location: Australia

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by nathan323 » 18 Jul 2017, 05:09

Excellent script.

Any way to exclude a particular scripts context menu entry, while still running script?

cmarabate
Posts: 1
Joined: 25 Mar 2020, 13:06

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by cmarabate » 25 Mar 2020, 15:09

FanaticGuru wrote:
14 Apr 2016, 15:47
KilliK wrote:sorry to bring this up, but I am encountering a problem with your script.
I set a custom folder to load of bunch of my scripts from there. It loads them fine but it doesnt hide their tray icons, apart from one randomly. I have set systray from Windows to show the ahk icons and tried to refresh them by moving my mouse over the systray but they just dont hide.
is this a bug or something that I must set in my scripts first?
I am using the latest version of AHK and Windows 10 Pro x64
The TrayIcon Library that AHK Startup uses to hide the tray icons does not work properly with Windows 10. I have updated the library. I may not have corrected every function in the library to work with Windows 10 but I did corrected the three functions required to hide tray icons to work correctly with Windows 10.

FG
I am having the same exact issue on Windows 10 64bit. Everything seems to work except it does not hide any of the tray icons from the scripts that it opened.

Thanks,

Chris

gibbons6546
Posts: 31
Joined: 07 Apr 2020, 11:53

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by gibbons6546 » 18 Apr 2020, 14:36

I'm having the same issue. The AHK Startup script does initially work as it should. That is, immediately after it is run it consolidates the tray icons of all the sub-scripts it runs. However, after some period of time the icons for each sub-script appear individually in the tray and the AHK Startup tray icon itself then disappears.

Unfortunately, this script is a bit too advanced for me to troubleshoot myself. Any help would be appreciated because this is a very useful script. Or perhaps someone knows of an alternative "startup" script?

Thank you

I am having the same exact issue on Windows 10 64bit. Everything seems to work except it does not hide any of the tray icons from the scripts that it opened.

gibbons6546
Posts: 31
Joined: 07 Apr 2020, 11:53

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by gibbons6546 » 24 May 2020, 12:53

Just wanted to follow-up and say the issue fixed on its own after I upgraded to the latest AHK version.
gibbons6546 wrote:
18 Apr 2020, 14:36
I'm having the same issue. The AHK Startup script does initially work as it should. That is, immediately after it is run it consolidates the tray icons of all the sub-scripts it runs. However, after some period of time the icons for each sub-script appear individually in the tray and the AHK Startup tray icon itself then disappears.

Unfortunately, this script is a bit too advanced for me to troubleshoot myself. Any help would be appreciated because this is a very useful script. Or perhaps someone knows of an alternative "startup" script?

Thank you

I am having the same exact issue on Windows 10 64bit. Everything seems to work except it does not hide any of the tray icons from the scripts that it opened.

ufunk
Posts: 54
Joined: 17 Jan 2020, 13:45

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by ufunk » 29 Oct 2021, 15:04

Hi, are there any updates on this issue? The sub-scripts still appear individually in the tray in Windows 10, even after updating ahk version.

User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 29 Oct 2021, 17:29

ufunk wrote:
29 Oct 2021, 15:04
Hi, are there any updates on this issue? The sub-scripts still appear individually in the tray in Windows 10, even after updating ahk version.

You need to also make sure you have the latest version of AHK Startup on the first page of this thread (which has been updated from time to time) as well as the latest version of AHK.

I cannot replicate the issue. I run AHK Startup on multiple computers every day without a problem. Various flavors of Windows 10 including Windows 10 Pro 64bit.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

raineedust
Posts: 1
Joined: 24 Nov 2021, 03:04

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by raineedust » 24 Nov 2021, 03:07

This is the best, least confusing AHK script startup implementation I've found on the Internet.

Can't believe how much Googling it took to arrive to such an intuitive method ... It deserves more attention. :/

User avatar
spaceowl
Posts: 18
Joined: 16 May 2021, 06:46

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by spaceowl » 27 Jan 2022, 07:56

@raineedust
Hello, could you add the icons of the ahk and exe files on the left side? That would be great! :)
Right now it looks so empty:
image.png
image.png (93.23 KiB) Viewed 3031 times
I would like it to have like here please, icons on the left side:
Image
Attachments
image.png
image.png (36.02 KiB) Viewed 3031 times

User avatar
spaceowl
Posts: 18
Joined: 16 May 2021, 06:46

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by spaceowl » 29 Jan 2022, 04:37

I have get it to work! :)

Simply just added after line 146 this:

Code: Select all

Menu, Tray, Icon, %index%, %A_ScriptDir%\%index%.exe, 0
So it looks so:

Code: Select all

	for index, Script in Startup
	{	
		PID := Script.PID
		Menu, Tray, Add, %index%, :SubMenu_%PID%
		Menu, Tray, Icon, %index%, %A_ScriptDir%\%index%.exe, 0
	}

Leeahtze
Posts: 18
Joined: 27 Feb 2022, 18:36

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by Leeahtze » 03 Mar 2022, 09:09

Is there a way to modify the script so it does not run the scripts inside folders of the mentioned folder?

Leeahtze
Posts: 18
Joined: 27 Feb 2022, 18:36

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by Leeahtze » 09 Mar 2022, 12:01

Anyone has a chance to modify the script so it does not run the scripts inside the subfolders of the listed/given folder? Thanks.

User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by FanaticGuru » 09 Mar 2022, 14:54

Leeahtze wrote:
09 Mar 2022, 12:01
Anyone has a chance to modify the script so it does not run the scripts inside the subfolders of the listed/given folder? Thanks.

If you do not want to recursively include subfolders you can remove the "1" at the end of the two loop commands that do this:

Code: Select all

Loop, %File_Exp%*.*,,1 ; Get full path of all files in folder and subfolders
; change to this
Loop, %File_Exp%*.* ; Get full path of all files in folder and NOT subfolders
and

Code: Select all

Loop, %File_Exp%,,1 ; Get full path of all matching files in folder and subfolders
; change to this
Loop, %File_Exp% ; Get full path of all matching files in folder and NOT subfolders

That should do it but have not tested it.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Leeahtze
Posts: 18
Joined: 27 Feb 2022, 18:36

Re: AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post by Leeahtze » 09 Mar 2022, 21:36

Thanks! It worked

Post Reply

Return to “Scripts and Functions (v1)”