glitchassassin / lackey

Lackey - Graphical desktop automation with Python
MIT License
616 stars 76 forks source link

Option in type() to suppress logging of typed strings #154

Closed ottonautti closed 5 years ago

ottonautti commented 5 years ago

I would like to be able to disable output to STDOUT when typing passwords to login prompts etc.

glitchassassin commented 5 years ago

Can you use Debug.off() and Debug.on() to temporarily switch off the logging output?

https://lackey.readthedocs.io/en/latest/lackey.html#lackey.DebugMaster.off

ottonautti commented 5 years ago

Can you use Debug.off() and Debug.on() to temporarily switch off the logging output?

https://lackey.readthedocs.io/en/latest/lackey.html#lackey.DebugMaster.off

I have tried it but I don't get the expected behaviour:

import lackey

def test_type():
    print(lackey.Debug.__dict__)
    np = lackey.App("Notepad")
    np.focus()
    lackey.type(np.window(), "my secret")

lackey.Debug.off()
test_type()
lackey.Debug.on(1)
test_type()

Outputs:

{'_debug_level': 0}
[action] Clicked at (Location object at (1440,523))
[action] Typing 'my secret' with modifiers 'None'
{'_debug_level': 1}
[action] Clicked at (Location object at (1440,523))
[action] Typing 'my secret' with modifiers 'None'
glitchassassin commented 5 years ago

Sorry, it's been a little while since I've looked at this.

Try disabling it with lackey.Settings.ActionLogs = False.

ottonautti commented 5 years ago

Turning action logs off works. Thanks!