Profile Categories & SplashImage Tray Area

Helpful script writing tricks and HowTo's
User avatar
OrangeCat
Posts: 23
Joined: 14 Jun 2022, 00:47

Profile Categories & SplashImage Tray Area

11 Apr 2024, 18:20

Hello,

I'm trying to make a script with profiles.
I have the profiles setup and all of that works perfect for changing to the next profile and everything via increments

There's 2 things that I'd like to do

- 1) I'd like to make it possible to navigate backwards to the prior profile rather than looping through the entirety...
- 2) I'd like to make it possible to jump into a separate "alternative" profile category to then jump-back into the default profile category...

Here's what I got so far:
(note that I'm using a gosub _splashsleep instead of a variables as I've still a hardtime at understanding the concept, being a good reason why I'm having trouble with that)

Code: Select all

            Profile:= 1
            Count := 4 ; THE NUMBER OF TOTAL PROFILES (EXCLUDING SPECIAL PROFILES)
            ProfileTemp := 0

            ChangeProfile: ; <--- I only know how to increment it (based from another post I found on here). I don't know how to go backwards.
            Profile := Profile = Count ? 1 : Profile + 1
                Gosub, _DisplayProfile
            RETURN

	    _DisplayProfile:
                If profile = 1
                    Gosub, _SplashImg_Profile_Default
                Else if profile = 2
                    Gosub, _SplashImg_Profile_MediaVideo
                Else if profile = 3
                    Gosub, _SplashImg_Profile_MediaAudio
                Else if profile = 4
                    Gosub, _SplashImg_Profile_SuperMario
                Else if profile = 10
                    Gosub, _SplashImg_AltProfile_AltFunctions
                Return
                ; Gosub, DisplayProfile
            RETURN

	    _SplashSleep: ; <--- Used this instead of a variable as I don't quite fully understand how to use them
                Sleep 400
            RETURN

            _SplashImg_Profile_Default: ; Profile 1
                SplashImage, D:\Admin\Config\AutoHOTKEY\PROFILES\POPUPS\Default.png, b x1470 y850
                Gosub, _SplashSleep
                SplashImage, Off
            RETURN 
      
            _SplashImg_Profile_MediaVideo: ; Profile 2
                SplashImage, D:\Admin\Config\AutoHOTKEY\PROFILES\POPUPS\MP4;MPC-HC.png, b x1470 y850
                Gosub, _SplashSleep
                SplashImage, Off
            RETURN 
        
            _SplashImg_Profile_MediaAudio: ; Profile 3
                SplashImage, D:\Admin\Config\AutoHOTKEY\PROFILES\POPUPS\MP3;Aimp.png, b x1470 y850
                Gosub, _SplashSleep
                SplashImage, Off
            RETURN 
        
            _SplashImg_Profile_PaintNet: ; Profile 4
                SplashImage, D:\Admin\Config\AutoHOTKEY\PROFILES\POPUPS\IMG;PAINT.NET.png, b x1470 y850
                Gosub, _SplashSleep
                SplashImage, Off
            RETURN 
        
            _SplashImg_AltProfile_AltFunctions: ; <--- This is my alternative Profile Category (to be able to jump back directly into prior-profile)
                SplashImage, D:\Admin\Config\AutoHOTKEY\PROFILES\POPUPS\AltFunctions.png, b x1470 y850
                Gosub, _SplashSleep
                SplashImage, Off
            RETURN 
            
            WinTransparentUp:
                DetectHiddenWindows, on
                WinGet, curtrans, Transparent, A
                If ! curtrans
                    curtrans = 255
                newtrans := curtrans + 16
                If newtrans > 0
                {
                    WinSet, Transparent, %newtrans%, A
                }
                Else
                {
                    WinSet, Transparent, OFF, A
                    WinSet, Transparent, 255, A
                }
                Return
            RETURN

            WinTransparentDown:
                DetectHiddenWindows, on
                WinGet, curtrans, Transparent, A
                If ! curtrans
                    curtrans = 255
                newtrans := curtrans - 16
                If newtrans > 0
                {
                    WinSet, Transparent, %newtrans%, A
                }
                Return
            RETURN

	    Launch_App1 & MButton::Gosub, ChangeProfile
	        
	    MButton & Launch_App1::
                ProfileTemp := Profile ; <--- I set this as a variable to store the current profile number
                Profile := 10
                Gosub, _DisplayProfile
            RETURN

    #IF Profile = 10 ; <--- This is my alternative profile, being a number that is above script-top's "count" value
            WheelUp::Gosub, WinTransparentUp 
            WheelDown::Gosub, WinTransparentDown 
            Launch_App1::
                Profile := ProfileTemp ; <--- This is to try to restore the prior profile, but doesn't seem to work
                Gosub, _DisplayProfile
            RETURN

Another thing
My splash image popup, I'm using an "improper" way to make them display near the tray area...
I have my setup where I disabled having taskbars on every monitor (just using 1 taskbar only)

Thus, is there a way I can make my image popup follow taskbar's tray area for whenever using a multi-monitor system?
User avatar
OrangeCat
Posts: 23
Joined: 14 Jun 2022, 00:47

Re: Profile Categories & SplashImage Tray Area

15 Apr 2024, 19:58

I figured out 1), How to "Profile reverse"

Code: Select all

            ChangeProfileUp:
                Profile := Profile = Count ? 1 : Profile + 1
                Gosub, _DisplayProfile
             RETURN
             
            ChangeProfileDown:
                Profile := Profile - 1
                If Profile = 0
                    Profile := Count
                Gosub, _DisplayProfile
            RETURN
The moment profile = 0, it instantly auto-changes to the last profile number, being the total count number value

Still figuring out how to make #2 possible, now that I've somewhat of a better understanding at variables / expression, legacy syntax etc.

Return to “Tutorials (v1)”

Who is online

Users browsing this forum: No registered users and 21 guests