This smart NavBar action uses an app as the context and casts the relevant information to an active PC. It’s most useful if you want to continue media consumption on the PC of your choice. This could range from opening web interfaces of the apps (Facebook, Messenger, WhatsApp, Chrome) to sending device-specific commands. What do I mean by “active PC”? This is the computer that has been used recently. I will base my tutorial on ActivePC write-up, so read that up for more details. I will use two ways of detecting the target machine to support more options. In the nutshell, you can cast to the target PC based on:
In this example, I will use the Facebook app as the context and www.facebook.com page to be opened on the target machine. An icon representing my laptop, desktop, and a work computer will display dynamically in the smarter NavBar. These will update based on the location and the last computer used. Smart NavBar: Cast to active PCEventGost watches There is a minute cooldown associated with the idle messages being issued on the machines, so if you change your computer and return to the same machine, the status won’t be posted. You could fix that with some EventGhost magic from this write-up and your creativity. Cast Facebook to active PCThe Tasker profile is simple, use Application context to show a new NavBar when Facebook is open. The NavBar contains the following configuration:
The Smart NavBar will contain the icon of the active PC and will run the task responsible for sending the information to the PC.
Tasker PROJECT: NB Facebook
Profile: NB Facebook Application: Facebook Enter: NB Open Facebook A1: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB Facebook %ActivePC)[1.0] ] If [ %DEVICELOCATION ~ home ] A2: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB Facebook WIFI)[1.0] ] If [ %DEVICELOCATION !~ home ] A3: Variable Set [ Name:%NBactiveApp To:Facebook ] Exit: NB Reset A1: Variable Set [ Name:%NBactiveApp To:none] A2: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right: ] I have created an Entry task which sets the variable %NBactiveApp to Facebook (needed if you going to have multiple apps) and assigns a correct NavBar. The exit task simply resets the NavBar to the default (back, centre, none) settings. Device Location ProfileBecause I promised the contextual control over PC’s that cannot run EventGhost, I can use also WiFi to override this profile. I will create another profile that sets the location to: home, work, or elsewhere. Once again, I will set the %DEVICELOCATION variable as this info can be used in different projects.
Tasker PROFILE: Device Location
Profile: Device Location State: Wifi Connected [ SSID:* MAC:* IP:* Active:Any ] Enter: Set Dev Locale A1: Variable Set [ Name:%DEVICELOCATION To:home] If [ %WIFII ~R SlowFrog|FastBerry ] A2: Variable Set [ Name:%DEVICELOCATION To:work] If [ %WIFII ~R ITC UK ] A3: Variable Set [ Name:%DEVICELOCATION To:elsewhere] If [ %WIFII !~R SlowFrog|FastBerry|ITC UK ] Exit: WIFI reset A1: Variable Set [ Name:%DEVICELOCATION To:elsewhere ] The location logic will be as follows:
If the phone is no longer connected the %DEVICELOCATION defaults to “elsewhere“. Now that I have the location framework, I can use this to control the active PC profile. Set Active PC Profile
Tasker PROFILE: Set Active PC
Profile: Set ACTIVEPC Event: AutoRemote [ Configuration:activePC (regex) ] Enter: Set Active PC A1: Variable Set [ Name:%ActivePC To:%arcomm ] A2: If [ %NBactiveApp ~ Facebook & %DEVICELOCATION ~ home ] A3: Navigation Bar [ Left:back[1.0] Center:home[1.0] Right:task(NB Facebook %ACTIVEPC)[1.0] ] A4: End If I’d suggest sticking both profiles (Set Active PC & Device Location) into the “main” folder, as these can be referenced by other projects too! Especially, if you are interested in automating WhatsApp (coming soon). Note that I have enclosed the Smart NavBar actions in IF statement, these actions are specific to Facebook action. I added the %DEVICELOCATION variable, as my dynamic options will only apply when I’m home. This way I can retain the information about the active PC without actually drawing a NavBar each time. The active PC is stored in the variable %ACTIVEPC (if you want to know why in CAPS, read this article). Each time I change the computer, Tasker receives an AutoRemote message and updates the variable. To make my life less complicated, each computer name is taken from the Join App. I can use the verbatim spelling of the %ACTIVEPC variable to send messages to Join devices. NB Facebook Laptop/Desktop/WiFiThe easiest way to update the icon in the NavBar was to create a duplicated task with the same action but different name and the icon.
Tasker TASK: NB Facebook Laptop/Desktop
NB Facebook Laptop A1: Join Send Push [ Configuration:Url: https://www.facebook.com/ Device Name: %ACTIVEPC Timeout (Seconds):60 ] A2: Flash [ Text:Sent to %ACTIVEPC Long:Off ] The location based task is slightly different and uses %DEVICELOCATION to set the correct Join push action:
Tasker TASK: NB Facebook WiFi
NB Facebook WIFI (51) A1: Join Send Push [ Configuration: Device: Laptop Url: https://www.facebook.com/ Timeout (Seconds):60 ] If [ %DEVICELOCATION ~ elsewhere ] A2: Join Send Push [ Configuration: Device: Work Url: https://www.facebook.com/ Timeout (Seconds):60 ] If [ %DEVICELOCATION ~ work ] A3: Flash [ Text:Done Long:Off ] In this case, the devices are hardcoded! Join Push messages are send based only on the %DEVICELOCATION taken from the Locale profile. Smart NavBar integrationThis is a stand-alone version of the Smart NavBar actions. Once I created the stand alone versions for each NavBar Task I will show you how to integrate it together. The link to that write up will be up soon! ConclusionAndroid NavBar is underutilised in my opinion, so it’s cool to add extra functionality without adding any additional menus. The contextual character of the NavBar means, that the action is there when you need it most. Next up, I will add extra smart NavBar actions to WhatsApp. You can download the standalone tasker project from here. If you like my work you can always buy me a coffee or support me via Patreon. Share this:Powered by WPeMatico The post Tasker Smart NavBar #1 Cast to active PC appeared first on PCStoreNearMe. via PCStoreNearMe http://bit.ly/30DtTLa
0 Comments
Leave a Reply. |