Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win10 issues (2) #4

Open
bobbonomo opened this issue Sep 27, 2021 · 1 comment
Open

Win10 issues (2) #4

bobbonomo opened this issue Sep 27, 2021 · 1 comment

Comments

@bobbonomo
Copy link

bobbonomo commented Sep 27, 2021

I've been playing around with your ducky2python thing and used a very basic Hello World Ducky script from ducktoolkit dot com userscripts.

Your translation of "GUI r" to pyautogui.hotkey("win","R") does not work on Win10. What works is pyautogui.hotkey("win","Run"). I realise the Ducky language specifies "GUI r" to get to the Run menu on Windows systems. Maybe at one time it did work.

The other thing is that since you wrap the output STRING in double quotes it does not escape the " and \ characters of the Ducky STRING command. This causes an syntax error.

This was just an exercise to learn more about Python and I came across your stuff. Figured you may want to know.

Ducky script used and converted online:

DELAY 3000
GUI r
DELAY 500
STRING notepad
DELAY 500
ENTER
DELAY 750
STRING Hello World!!!
ENTER
STRING $userDir = (Get-ChildItem env:\userprofile).value + '\Ducky Report ' + $folderDateTime
ENTER
STRING $Report = "<div id=left><h3>Computer Information</h3></div>"
ENTER

Rather than just raise an issue, I decided to try to solve the escape issue. It's easy to just complain.
Line 72 of the ducky2python.js file
previousStatement = "pyautogui.typewrite(\"" + duckyScript[line].slice(7).replace(/\\/g,"\\\\").replace(/\"/g, "\\\"") + "\", interval=0.02)";

Line 71 of the ducky2python.py file
previousStatement = "pyautogui.typewrite(\"" + (line[7:]).replace("\\","\\\\").replace("\"", "\\\"") + "\", interval=0.02)"

No idea for the "GUI r" issue.

I could never figure out this pull thing of github so I will not even try.

@ParzivalAFK
Copy link

bobbonomo Thank you for bringing this to attention. I had no idea why it was bringing up a snipping tool instead of the run prompt. "win","r" actually still does work to open up the run prompt and I use that all the time with daily tasks... however the caps version "win","R" does not and thanks to your mentioning here I was able to catch that and not dismiss this tool.

I know this is years after and you probably do not really need it anymore but nonetheless I fixed both of your mentioned issues it and submitted the changes through a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants