This is the last part of this series. Please make sure you have seen at least part one. Part two and three are similar and worth checking too!
This sub-menu will control the screen timeout on a PC. I have added it, as I want to have an easy control over the timeout when I’m using a remote desktop. At the end of the tutorial, I will also show you how to set up other actions. The profile files are available at the end of this part.
EventGhost
The set up is very similar to the volume menu. An AutoRemote action is issued, the EventGhost changes the screen timeout options then reports back. Repeat this for each timeout option you want to have. For the sake of the consistency, I have four.
You know how to set up a trigger and issue the response already so here is the screen action:
powercfg -Change -monitor-timeout-ac 5
Use Windows Command option in EventGhost actions. Change the value to any number you wish.
Tasker
Open Sub-Menu Profile/ SubMenu Open
Create a new notification and link it to the IF %ancomm ~ openscreen If the screen icon from the first row is pressed – this action will be called.
Notification is configured as follows:
- Buttons – as per your liking, make sure the first row is consistent.
- Actions: the first row starts with open (see template) but the screen menu icon should have openclose action assigned instead. The second row has actions ending with ‘‘…pc”. I used screen1pc,screen5pc,screen30pc,screen120pc.
- Color, only a second color should be different.
- Prefix for actions: buttontwo
Submenu Actions/Send AR
Since the framework is already done, we don’t need to add anything else. All that hard work from the part one finally paid off.
PC Feedback/Notification
The EventGhost will issue a reply when the screen timeout is changed through our screen menu. The to simplify the process (you can go nuts) the AutoRemote message is sent in this form pc=:=screen(value). This means that we have to intercept all the messages starting with (regex)screen.*
In a similar way to power menu, I’m creating a variable %PcScreen and simply setting the value of it to the %arcomm. The value will get assigned to the default notification. At this stage go and update the default notifications (the ones that have only 4 icons) with this variable. Each notification should have %PcPowerontime,%PcVolume and %PcScreen in the text field.
And that was all!
Bonus:
Lights Menu
Open Sub-Menu Profile/ SubMenu Open
Create a new notification and link it to the IF %ancomm ~ openlight If the lights icon from the first row is pressed – this action will be called. (update the default notification and change the column count to 5 (see part one)
You will have to change the following in each notification created so far:
- Column count (5:4) to reflect number of your menus
- Actions – add new action everywhere (one for menu, one for submenu)
- Enabled: 1,1,1,1,1 (equal to number of icons)
Notification is configured as follows:
- Buttons – as per your liking, make sure the first row is consistent.
- Actions: the first row starts with open (see template) but the lights menu icon should have openclose action assigned instead. The second row has actions ending with ‘‘…tsk”. I used lighttsk as I only have one smart light.
- Color, only a second color should be different.
- Prefix for actions: buttontwo
Submenu Actions/Send AR
Our profile can intercept only actions ending with …pc, therefore we have to modify it. The profile context will respond to regex pc|tsk and the task will contain IF statement when sending the previously made AR action: IF %ancomm =R pc.
Add another action – Perform Task and create condition IC %ancomm =R tsk. The action to perform is %ancomm. It’s easier to rename a task to fit the bill than create a name matching profile.
Light tsk
I only control one light at this time. The controller is simplistic as I made the WIFI module myself and I’m currently working on it. Here is how you create a toggle switch.
Create the variable %lightStatus and set it to 0. I’m using the HTTP Get request to turn on/off the light. When the %lightStatus = 0 the light is off and when it’s 1 the light is on. Create the IF condition that checks the value of the variable, updates the value respectively, and sets the correct action then stops:
lighttsk (26) A1: If [ %lightState ~ 0 ] A2: HTTP Get [ Server:Port:192.168.1.163/?pin=ON1 Path: Attributes: Cookies: User Agent: Timeout:10 Mime Type: Output File: Trust Any Certificate:Off Continue Task After Error:On ] A3: Variable Set [ Name:%lightState To:1 Recurse Variables:Off Do Maths:Off Append:Off ] A4: Stop [ With Error:Off Task: ] A5: Else A6: HTTP Get [ Server:Port:192.168.1.163/?pin=OFF1 Path: Attributes: Cookies: User Agent: Timeout:10 Mime Type: Output File: Trust Any Certificate:Off Continue Task After Error:On ] A7: Variable Set [ Name:%lightState To:0 Recurse Variables:Off Do Maths:Off Append:Off ]
For any other setups simply run the task that is named in the same way as the %anconn message issued by the sub-menu. If you need more than one menu, rinse and repeat the steps.
Project Download
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.