AHK Startup (Consolidate AHK Scripts' Tray Icons)

Post your working scripts, libraries and tools
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

20 Mar 2014, 17:37

I don't know it I'm doing something wrong or if there's a problem somewhere else, but I've been unable to get the new version of the script working.

Even when I put just a single script name between the continuations, using the identical format that works in the first version, so that it looks like this....

Code: Select all

Files := [  ; Additional Startup Files and Folders Can Be Added Between the ( Continuations  ) Below
(Join,
"AHKronym.ahk"
)]
....I get this message.

Image

Any ideas what the problem might be?

Thank you!
Last edited by AHKxx on 20 Mar 2014, 18:01, edited 1 time in total.
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

20 Mar 2014, 17:47

Updated Script on First Page

Change Log (2014-03-20):
Added support for relative paths using .\ at the start of a file path.
One dot uses the folder the script is located.
Each additional dot steps back one folder.

The initialization of the Files array contains various examples. This information must be customized to contain the files that are to be started.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

20 Mar 2014, 17:59

AHKxx wrote:

Code: Select all

Files := [  ; Additional Startup Files and Folders Can Be Added Between the ( Continuations  ) Below
(Join,
"AHKronym.ahk"
)]
....I get this message.

Image

Any ideas what the problem might be?

Thanks you!
Somehow you are missing a line. Maybe a copy paste mistake or accidental hit of delete key at the wrong time.

Code: Select all

    DetectHiddenWindows, %Setting_A_DetectHiddenWindows%
    Return  idxTB
}

TrayIcon_Remove(hWnd, uID) ; <--- YOU ARE MISSING THIS LINE.
{
        NumPut(VarSetCapacity(NID,(A_IsUnicode ? 2 : 1) * 384 + A_PtrSize * 5 + 40,0), NID)
        NumPut(hWnd , NID, (A_PtrSize == 4 ? 4 : 8 ))
        NumPut(uID  , NID, (A_PtrSize == 4 ? 8  : 16 ))
        Return DllCall("shell32\Shell_NotifyIcon", "Uint", 0x2, "Uint", &NID)
}
I would just copy and paste / download the whole thing again. I posted a new update anyways.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

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

21 Mar 2014, 10:01

so this means i run Hotkey Help separately from AHK Startup and not from the AHK Startup so that there are 2 icons (running) in the tray at all times: one is AHK Startup and the other is Hotkey Help. these are the minimum number of AHK scripts/icons required to manage ALL the AHK scripts.
AHKxx wrote:@Guest10 If I understand what you're asking, it's possible to do that if you also use FG's Hotkey Help script (see his sig.)

It's useful on its own but makes a really great pairing with the Startup script (having them both running, its easy to forget that they're actually 2 diff scripts!), and it lets you selectively pause, stop, suspend, edit, reload, and open script. There's a menu on top... and if you open the script and look for where the menu is generated, and yo add an &mpersand in front of each menu item, you get shortcut keys. Very cool.

I haven't been able to get the new Startup to work without throwing one error or another. Not sure if it's something I'm doing or not doing or what. Will post later with more deets if I can't figure it out.

@FG Thank you for these 2 fantastically helpful scripts!
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

21 Mar 2014, 11:19

FanaticGuru wrote: I would just copy and paste / download the whole thing again. I posted a new update anyways.

FG
That was it. Thanks!
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

21 Mar 2014, 11:21

Guest10 wrote:so this means i run Hotkey Help separately from AHK Startup and not from the AHK Startup so that there are 2 icons (running) in the tray at all times: one is AHK Startup and the other is Hotkey Help. these are the minimum number of AHK scripts/icons required to manage ALL the AHK scripts.
No, the only script you run is AHK Startup.

Then AHK Startup runs all the other scripts you want including Hotkey Help.

Then to manipulate individual scripts (Stop, Pause, Reload, Edit, etc.) you hit Win+F1 to open up the Hotkey Help dialog where you can do all these things. Plus see all the scripts you have running and help comments that have been added in the scripts for each hotkey.

You will only have one tray icon for all your scripts. Which means you basically lose the right click menu you would normally have for each scripts tray icon as they no longer have an individual icon.

It is possible I could add a complex right click menu for the one icon that allowed you to access all the scripts but it could be a pretty cluttered menu with layers of choices. I never use the right click tray icon menu and do all that stuff through Hotkey Help but I might look into adding it just for fun. Before I was trying to keep AHK Startup relatively small and simple code wise but maybe that does not matter much anymore.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

21 Mar 2014, 12:02

I find that when I reload a script after editing it using the Hotkey Help menu, it adds an icon to the tray. Am I right that the way around that is instead of reloading the edited script to reload the full Startup from HH?

So far when using Startup, I have only two icons in the tray, Startup and the default AutoHotKey.ahk.

My understanding is there is no way to get rid of that default script without having AHK bug you to recreate it. Is that correct?

To get around that, I just added the default script path to Startup, which runs it a second time, and removes the icon as part the Startup routine. Is that the best way to do it?
Last edited by AHKxx on 21 Mar 2014, 12:13, edited 1 time in total.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

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

21 Mar 2014, 12:11

yes that would be revolutionary cause i am now running 12 scripts with icons in the tray! :shock:
FanaticGuru wrote:
Guest10 wrote:so this means i run Hotkey Help separately from AHK Startup and not from the AHK Startup so that there are 2 icons (running) in the tray at all times: one is AHK Startup and the other is Hotkey Help. these are the minimum number of AHK scripts/icons required to manage ALL the AHK scripts.
No, the only script you run is AHK Startup.

Then AHK Startup runs all the other scripts you want including Hotkey Help.

Then to manipulate individual scripts (Stop, Pause, Reload, Edit, etc.) you hit Win+F1 to open up the Hotkey Help dialog where you can do all these things. Plus see all the scripts you have running and help comments that have been added in the scripts for each hotkey.

You will only have one tray icon for all your scripts. Which means you basically lose the right click menu you would normally have for each scripts tray icon as they no longer have an individual icon.

It is possible I could add a complex right click menu for the one icon that allowed you to access all the scripts but it could be a pretty cluttered menu with layers of choices. I never use the right click tray icon menu and do all that stuff through Hotkey Help but I might look into adding it just for fun. Before I was trying to keep AHK Startup relatively small and simple code wise but maybe that does not matter much anymore.

FG
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

21 Mar 2014, 12:59

AHKxx wrote:I find that when I reload a script after editing it using the Hotkey Help menu, it adds an icon to the tray. Am I right that the way around that is instead of reloading the edited script to reload the full Startup from HH?

So far when using Startup, I have only two icons in the tray, Startup and the default AutoHotKey.ahk.

My understanding is there is no way to get rid of that script without having AHK bug you to recreate it. Is that correct?

To get around that, I just added the default script path to Startup, which runs it a second time, and removes the icon as part the Startup routine. Is that the best way to do it?
As for the reloading of a script creating a tray icon, I don't see a good way around that. AHK Startup is only designed to consolidate tray icons of scripts it starts and not necessarily all AHK scripts. When you reload a script it is basically terminated and then run again without AHK Startup's knowledge just like if you started any other scripts outside of AHK Startup. This generates a new Processor Id (PID) which is how AHK Startup keeps track of the scripts it has control over.

AHK Startup does not really even have to be done at bootup, that is just how I use it. You could make three copies of AHK Startup and rename them Work Scripts, Web Scripts and Game Scripts. Then define within each of those which scripts it starts. Then run them as you need them, one or all three and have three tray icons that each start and stop related scripts together. AHK Startup is really about just consolidating multiply scripts to start and stop together like suites of scripts that you want to run together.

The only easy way around the reload issue is to reload AHK Startup which will have it reload all the scripts it controls.

As for the default AutoHotkey.ahk script. I do not have that scripts. I believe that is the little tutorial script that is offered to create the first time you install AutoHotkey. You probably do not need that scripts. If a shortcut to that is in your Windows Startup folder you can probably delete that if you did not customize it to do something useful. You just need to do a little investigating how that script is being started. You don't need that script or tray icon running. I only have one AutoHotkey related tray icon and that is AHK Startup.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

21 Mar 2014, 13:30

Thank you for this information, FG. Very helpful in getting a better fix on what's going on.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

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

22 Mar 2014, 15:30

well i restarted my computer with AHK Startup with 12 lines total as follows for 12 scripts (shown below in red). it started alright but then it cut off after 10 scripts. The 11th script showed only as Su (instead of Super_Alerts) and the 12th was a complete no show (Toggler). as you see i put them in alphabetic order in the AHK Startup script (shown below in red). another problem for those 10 scripts that appeared correctly and in alphabetic order was that if i ever refreshed (reloaded) any one of them (such as Meta Macro) it immediately showed separately beside (outside of) the AHK Startup icon in the tray. this means any reload would defeat the purpose of centrally placing all running scripts under one icon in the tray as they show up as a separate icon in the tray!

Files := [ ; Additional Startup Files and Folders Can Be Added Between the (Continuations) Below
(Join,
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Alert_TC-Proz_Timer.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\FocuslessScroll.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Glossary.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Hotkey_Help.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Launch Panel.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Meta Macro.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Multiple_Alerts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\PrintScreen.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Running_Scripts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Super_Alerts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Toggler.ahk"
)]
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

22 Mar 2014, 18:21

What I've been doing when I want to reload one of the scripts I have in the Startup script is, after I save it, I just run the whole Startup Script again, which reloads everything and keeps it all at 1 tray icon.

I had been running AutoHotKey.exe at startup which always ran the default script in Users. Then I would manually run FG's Startup. Now, I've gotten rid of AutoHotKey.exe and have set things up so the StartUp script runs automatically on boot, and I have a shortcut to it in the Start menu, so I can quickly rerun it as needed. The Help script is loaded by the Startup script. And I interface with everything having to do with AHK through the one Help script. It's awesome. Makes it all feel like one centralized application.

FWIW, FYI, I use a free program called Startup Delayer to control my whole startup sequence. That's what I've added the AHK Startup script to. And the only thing I'm running directly through the Windows startup process (other than services and maybe one or two other things) is Startup Delayer. It's at www.r2.com.au. Very convenient. Makes for a smoother and more controlled startup.
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

22 Mar 2014, 18:27

One thing I'd like is if it was possible to sort the order of the scripts displayed by Hotkey Help other than alphabetically.

Not a big deal, but I'd also like to comment out the lines that make the "confirmation" window load when the Startup script is run from a scratch.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

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

22 Mar 2014, 22:04

is Startup Delayer shareware, freeware, or for sales? some of my scripts reload (reset) other scripts. it would be impractical to quit and restart AHK Starter each time these scripts are reloaded (reset).
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

22 Mar 2014, 23:34

There is a free Standard version and a paid Premium version. I use the Standard and find it does everything I need. They released a new version 3 last month.)

If you put the first script in a sequence of scripts into the delayer, when the delay triggered that first script (you have control over the order of all startup processes managed by the delayer), then if that script loads other scripts, it would do that as usual.

Come to think of it, that's what I'm doing. I have Startup in the delayer. When it runs, it in turn runs everything in the specified folder, including Hotkey Help. None of my scripts are doing anything very fancy, and reloading the entire Startup script after editing one of its called scripts is inconsequential: I just terminate Startup using its ctrl alt win escape command, then immediately rerun it from a shortcut on the start menu. It doesn't even seem necessary to terminate it first, I just rerun it over whatever else is already running. YMMV.
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

24 Mar 2014, 12:17

Guest10 wrote:well i restarted my computer with AHK Startup with 12 lines total as follows for 12 scripts (shown below in red). it started alright but then it cut off after 10 scripts. The 11th script showed only as Su (instead of Super_Alerts) and the 12th was a complete no show (Toggler). as you see i put them in alphabetic order in the AHK Startup script (shown below in red). another problem for those 10 scripts that appeared correctly and in alphabetic order was that if i ever refreshed (reloaded) any one of them (such as Meta Macro) it immediately showed separately beside (outside of) the AHK Startup icon in the tray. this means any reload would defeat the purpose of centrally placing all running scripts under one icon in the tray as they show up as a separate icon in the tray!

Files := [ ; Additional Startup Files and Folders Can Be Added Between the (Continuations) Below
(Join,
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Alert_TC-Proz_Timer.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\FocuslessScroll.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Glossary.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Hotkey_Help.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Launch Panel.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Meta Macro.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Multiple_Alerts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\PrintScreen.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Running_Scripts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Webcast-Other\Super_Alerts.ahk"
"C:\Documents and Settings\HP_Administrator\My Documents\051809\AutoHotkey\Toggler.ahk"
)]
In all likelihood all of your scripts are running but the tooltip has a 127 character limit. There is nothing I can do about the 127 character limit on the tooltip. The tooltip can only display so much information.

But I am getting ready to upload a new version that also list the scripts controlled when you right click on the tray icon which will let you see all of them that way as well as provide some individual control over them.

Currently you cannot reload one script individually without causing it to be terminated, a new version of it ran which then has its own tray icon and is not being controlled by AHK Startup.

You can right click on the tray icon and choose "Reload this Script". That will terminate AHK Startup along with all the scripts it is controlling and restart AHK Startup along with restarting all the scripts it is controlling. Basically reloading all the scripts as a group.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

24 Mar 2014, 13:03

Updated Script on First Page

Change Log (2014-03-22):
Added a custom right click menu to the AHK Startup tray icon to show scripts being controlled.
Custom menu also allows some individual control of scripts.

I had some problems with Pause and Suspend status being accurate when those status where changed by means outside of the AHK Startup custom menu. (ie changing those states by way of Hotkey Help script for example) I believe I can resolve those problems at some point.

Also individual reload of a script is not supported. That is tricky also but I believe I can resolve that problem too at some point. Till then you have to use the reload of AHK Startup in the root menu to reload all the scripts together.

It is important to realize that everything from Open on down on the right click menu is the default script menu and is only referring to the AHK Startup script itself. Choosing "Suspend Hotkeys" for example will only suspend the hotkeys in AHK Startup and not all the scripts it is controlling.

"Reload This Script" will reload AHK Startup which by the nature of AHK Startup will cause it to rerun all the scripts it controls in effect reloading them.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
AHKxx
Posts: 54
Joined: 26 Feb 2014, 01:37

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

24 Mar 2014, 16:36

Nice update, with the right click menu. Thanks!

In Startup, I am using a path to reference the files I'm loading (plus one direct path to another script.)

I'm getting an interesting error. (I'm on Windows 7 32 bit.)

On the right click menu, when I select any of the script submenus, and then select some of the options (other than Exit), I get the following error message about a "Nonexistent menu item", always on the same line. However, the indicated script is in fact there.

Image

Following this error, the specified script disappears from Startup's rc tray menu and tooltip -- BUT is still running correctly.

Additionally, even when I am NOT getting this error and things run (apparently) as expected, the specified script is still disappearing from Startup's tray menu/tooltip BUT is also in fact still running.

I also noticed that no matter what script I chose in Startups tray menu, it was always the same script specified in the error, which was the alphabetically last script in the folder (and which again continued to run even after disappearing from Startups menu.)

On a hunch, I changed the name of the specified problem script so that it was no longer alphabetically last. Then I exited Startup (and all running scripts.)

Sure enough, when I repeated the above steps, the script that was specified in the error was now a different one, which was now the alphabetically last one in the folder -- which happened to be Hotkey Help.ahk, and which was still running and working as expected.

So -- just pure speculation here -- something odd seems to be going on with how Startup is counting or otherwise parsing the scripts in the folder.... or something like that?
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

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

24 Mar 2014, 17:55

Updated Script on First Page

Change Log (2014-03-24):
Fixed a missing set of {} that was causing weird results with the new custom right menu.

Thanks for taking the time to test and post AHKxx!

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

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

24 Mar 2014, 18:37

>> In all likelihood all of your scripts are running but the tooltip has a 127 character limit. There is nothing I can do about the 127 character limit on the tooltip. The tooltip can only display so much information.

doh!! but thanks for the update i'll run it at the next start-up!

Return to “Scripts and Functions”

Who is online

Users browsing this forum: cyruz and 37 guests