It is currently April 30th, 2024, 2:09 pm

How to make an icon toggle?

Get help with creating, editing & fixing problems with skins
rainwelt
Posts: 6
Joined: October 7th, 2019, 5:47 pm

Re: How to make an icon toggle?

Post by rainwelt »

balala wrote: October 9th, 2019, 12:16 pm You can now create a workaround to have only one button visible at a time, not both. Interested?
Yes please balala that could work well and I'll learn more I guess, thank you.
User avatar
balala
Rainmeter Sage
Posts: 16190
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to make an icon toggle?

Post by balala »

rainwelt wrote: October 10th, 2019, 4:54 am Yes please balala that could work well and I'll learn more I guess, thank you.
Not sure what the [Square6] meter is used for (that's why have I commented it out below), but here is one possibility:

Code: Select all

[app6]
Meter=Image
ImageName=TempClose2.png
w=20
h=18
X=1098
Y=3
HideOnMouseOver=0
FadeDuration=0
AlphaValue=1
Hidden=1
LeftMouseUpAction=["C:\Windows\nircmd.exe" sendkeypress "ctrl+c"][!HideMeter "app6"][!ShowMeter "App7"][!Redraw]

;[Square6]
;Meter=Image
;SolidColor=0,0,0,1
;H=23
;w=40
;x=520
;y=0
;HideOnMouseOver=0
;FadeDuration=0
;AlphaValue=1
;C:\Windows\nircmd.exe sendkeypress ctrl+c

[App7]
Meter=Image
ImageName=TempOpen2.png
w=20
h=18
X=1338
Y=3
HideOnMouseOver=0
FadeDuration=1
AlphaValue=255
LeftMouseUpAction=["C:\Windows\nircmd.exe" sendkeypress "ctrl+s"][!ShowMeter "app6"][!HideMeter "App7"][!Redraw]
Note that I added a Hidden=1 option to the [app6] meter, to hide it on the very first moment. I did this because when you refresh the skin the AIDA64 sensor panel supposably is closed and you'll open it with the appropriate button of skin ([App7]). So, in this moment, [App7] is visible, while [app6] isn't, due to the added Hidden=1 option.
When you click [App7], AIDA64 is launched, [App7] hidden and [app6] shown. Now you can use this last button to close AIDA64.
Note a disadvantage of this approach: the skin doesn't know when the app is running. So, if when you load it, if AIDA64 is started, the skin will have no idea about this and will act as if the app wouldn't run.
There might be a solution of this problem as well. You have to use a Process plugin, to know when the app is running and when it doesn't. Unfortunately I don't have it installed, so I can't say what is the proper process name, but if you can identify it, we can add the plugin measure to furtherly improve the code.
Please check the above code and let me know how does it work for you. If interested, please try to figure out the name of the process. If you succeeded please let me know, to can modify the code accordingly.
rainwelt
Posts: 6
Joined: October 7th, 2019, 5:47 pm

Re: How to make an icon toggle?

Post by rainwelt »

Well balala that has worked perfectly, by matching the x-y co-ordinates when using your code I now have that working toggle. Looks like the process plugin won't be needed there are zero issues with this. Many thanks for the help gentlemen!
User avatar
balala
Rainmeter Sage
Posts: 16190
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to make an icon toggle?

Post by balala »

rainwelt wrote: October 10th, 2019, 6:48 pm Well balala that has worked perfectly, by matching the x-y co-ordinates when using your code I now have that working toggle.
Glad if you got it working.
rainwelt wrote: October 10th, 2019, 6:48 pm Looks like the process plugin won't be needed there are zero issues with this.
If every time you're using exclusively the skin to launch / close the app, it's ok, I think.