ducky2python icon indicating copy to clipboard operation
ducky2python copied to clipboard

Win10 issues (2)

Open bobbonomo opened this issue 3 years ago • 1 comments

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.

bobbonomo avatar Sep 27 '21 19:09 bobbonomo