How to determine payload for which windows user account is unlocked?

If you have a question or need help, this is the place to be.
Post Reply
Mebejedi
Posts: 2
Joined: Fri Dec 28, 2018 11:29 pm

How to determine payload for which windows user account is unlocked?

Post by Mebejedi » Mon Dec 31, 2018 6:46 pm

Hi! Brand-new EG user here. I've got it connect to Webcore/ST, and can turn my computer off and on with notifications.

However, when setting up a piston to notify me which windows user account has been unlocked, I've been stumped understanding payloads.

Image

If I just use System.ConsoleDisconnect, I get two connect and two disconnect notifications (I guess Windows does both twice) and no specification. If I throw the payload into the event in the configuration window, it doesn't work. How can I parse the payload into WC to let me know which account was unlocked?

I've read two other threads, but it doesn't seem to apply to my situation (or I don't understand how it would). Please help!

viewtopic.php?t=10182

viewtopic.php?t=6934
Attachments
User Account.jpg

User avatar
yokel22
Experienced User
Posts: 262
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: How to determine payload for which windows user account is unlocked?

Post by yokel22 » Tue Jan 01, 2019 5:33 pm

You'll need to evalulate the payload. Get rid of the payload value on your event. Just use System.ConsoleConnect.

There are a multitude of ways of going about this. This is merely one example to skin the cat. Below the event, add a python script action. Within the script, paste the code below.

Code: Select all

if eg.event.payload[0] == "Eric":
     eg.Exit
else:
     eg.StopMacro
This will make it so the macro only continues if the payload value matches "Eric". Just add your actions you want to run below the python script.
Last edited by yokel22 on Fri Jan 04, 2019 10:36 am, edited 1 time in total.

User avatar
kgschlosser
Site Admin
Posts: 4506
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to determine payload for which windows user account is unlocked?

Post by kgschlosser » Wed Jan 02, 2019 9:55 am

@yokel22 problem in your code.

You probably just missed seeing it. the payload is a list.

all payload data that is attached to a System. event is going to be a list.

This is all that is really needed. if the user is not Eric it will stop the macro. since the script has no other code there is no real necessity to call eg.Exit()

Code: Select all

if eg.event.payload[0] != "Eric":
     eg.StopMacro()

and if you wanted to use a python command instead of a python script

Code: Select all

if eg.event.payload[0] != "Eric": eg.StopMacro();
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 262
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: How to determine payload for which windows user account is unlocked?

Post by yokel22 » Wed Jan 02, 2019 11:02 pm

Thanks kg. You're correct, i quickly glanced at it & hammered code from my phone.

User avatar
kgschlosser
Site Admin
Posts: 4506
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to determine payload for which windows user account is unlocked?

Post by kgschlosser » Thu Jan 03, 2019 2:28 am


      NERD



Oh man... from the phone...

Punctuation really sucks when keying from a phone. and programming is all about the punctuation. the []'s are the worst too. I am pretty sure ya have to shift 2 times to get to it. and then you have to repeat the same deal to close the bracket

see I was smart... I bought a little micro blueteeth keyboard.

Even still if I really wanted to complete the whole nerd ensemble I would need that OTG cable with a small 4 port hub plug in the wireless mouse and keyboard dongle along with a portable hard disk. and bust out with the full keyboard and mouse... I day hate to say this. But I have done this. There is a special USB you can get that is a y cable. and it taps the power and ground and gives you an end so you can plug your charger in at the same time. issue is you will not get the fast charge (how the phone knows the charger is capable of fast charge is the RX and TX data wired are shorted together).
If you like the work I have been doing then feel free to Image

User avatar
yokel22
Experienced User
Posts: 262
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: How to determine payload for which windows user account is unlocked?

Post by yokel22 » Fri Jan 04, 2019 10:36 am

Oh, ive got the nerd ensemble :) . I'll hook up an otg & keyboard to my tablet sometimes. Its just quicker to type on a phone.

** fixed example **

User avatar
kgschlosser
Site Admin
Posts: 4506
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: How to determine payload for which windows user account is unlocked?

Post by kgschlosser » Fri Jan 04, 2019 3:04 pm

ok the really kick ass thing about the OTG cables....

I do not know if you know this or not.. But you can flash Arduinos and ESP8266's from a tablet or a phone over the USB.. LOL It is quite handy if you need to update the firmware and don't want to have to dink around with unplugging everything from it or hauling a laptop over to it.. I have a few of them buried in the ceiling of my media room. I placed the things right above some trim. and the trim i have held up with 40lb Velcro. so i just have to pull the trim down and plug in.
If you like the work I have been doing then feel free to Image

Post Reply