Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

EG payload variable not expanding properly in cmd line arg

If you have a question or need help, this is the place to be.
Post Reply
User avatar
caffeinatedcoder
Posts: 20
Joined: Wed Jul 06, 2016 4:56 pm

EG payload variable not expanding properly in cmd line arg

Post by caffeinatedcoder »

I'm trying to use the following action to unlock my computer

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1722">
    <Action>
        System.Execute(u'C:\\Windows\\System32\\tscon.exe', u'1 /dest:console /password:myPassworP', 0, False, 2, u'', False, True, u'', False, True, False, False)
    </Action>
</EventGhost>

It works fine when the password is hardcoded, but not when I try to use a variable in place of it. Example

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1722">
    <Action>
        System.Execute(u'C:\\Windows\\System32\\tscon.exe', u'1 /dest:console /password:{eg.event.payload.arcomm}', 0, False, 2, u'', False, True, u'', False, True, False, False)
    </Action>
</EventGhost>

This second example macro seems to run all the way through because I get the response on my phone saying the computer is successfully unlocked, but the lockscreen is still present. Any idea why this isn't working?
pro┬Àgram┬Àmer (n) An organism capable of converting caffeine into code.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG payload variable not expanding properly in cmd line a

Post by kgschlosser »

use the action Run Application in System and DO NOT check the disable parsing of switches for the command line options

the command line options is where you will want to put the command line switches for the program you want to run
If you like the work I have been doing then feel free to Image
User avatar
caffeinatedcoder
Posts: 20
Joined: Wed Jul 06, 2016 4:56 pm

Re: EG payload variable not expanding properly in cmd line a

Post by caffeinatedcoder »

That's what I'm doing already. Image
pro┬Àgram┬Àmer (n) An organism capable of converting caffeine into code.
User avatar
caffeinatedcoder
Posts: 20
Joined: Wed Jul 06, 2016 4:56 pm

Re: EG payload variable not expanding properly in cmd line a

Post by caffeinatedcoder »

Sorry, I noticed after I took that screenshot that the disable parsing was checked. I tried with it unchecked and the variable and it still does exactly what I said in my first post. The way in the screenshot works only with the password hard-coded.

EDIT: Scratch that, I got it working using your suggestion. Stupid typo on my end. Unchecking the box did the trick, thanks :)
pro┬Àgram┬Àmer (n) An organism capable of converting caffeine into code.
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: EG payload variable not expanding properly in cmd line a

Post by kgschlosser »

LOL.

any time you see anything about parsing a string in a dialog. it is almost always for doing the curly bracket around the python expression or variable and if it should look for you doing that or not...
If you like the work I have been doing then feel free to Image
Post Reply