pacpie Posted October 12, 2023 Posted October 12, 2023 Real simple script. Just want to fire up a Power Automate flow. Run("C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe") WinWaitActive("Power Automate", "", 10) WinMove("Power Automate","",0,0) WinSetState("Power Automate","", @SW_MAXIMIZE) MouseClick("left",571,253,1) Exit It worked fine on my laptop. Then when I tried it on my desktop (Win 10), it opens the file and does nothing after (doesn't maximize let alone left click). Where do I begin?
Nine Posted October 12, 2023 Posted October 12, 2023 First, you need to check return value and @error for each statement to identify which statement is failing. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Musashi Posted October 12, 2023 Posted October 12, 2023 As already recommended by @Nine : Local $PID, $hHandle, $iResult $PID = Run("C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $PID = ' & $PID & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $hHandle = WinWaitActive("Power Automate", "", 10) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hHandle = ' & $hHandle & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $hHandle = WinMove("Power Automate","",0,0) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hHandle = ' & $hHandle & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iResult = WinSetState("Power Automate","", @SW_MAXIMIZE) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iResult = ' & $iResult & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iResult = MouseClick("left",571,253,1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iResult = ' & $iResult & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Exit "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
pacpie Posted October 12, 2023 Author Posted October 12, 2023 I only see the following: >Exit code: 0
pacpie Posted October 12, 2023 Author Posted October 12, 2023 I just tested it again on my laptop which is a work laptop and far more locked down admin wise. My desktop has no such restrictions. File is in a normal spot too.
pacpie Posted October 12, 2023 Author Posted October 12, 2023 To be 100% clear, I used the code suggested above in SciTE-Lite and tried compile/build. Oddly enough, I purposely misspelled one of the function names and it still returned that Exit code message on the right pane. I am new to this software so I apologize ahead of time if I'm missing something completely obvious.
Nine Posted October 12, 2023 Posted October 12, 2023 ConsoleWrite don't work, because you are running the script from a net drive. Copy your script to local drive... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Developers Jos Posted October 12, 2023 Developers Posted October 12, 2023 Or does the Program run at Admin level and your script at regular level? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
pacpie Posted October 12, 2023 Author Posted October 12, 2023 I put the script on my C drive but still no luck. It literally opens up Power Automate but then just does nothing after that. I am logged in as Admin. I've tried running the script a few different ways (x64) vs. (x86). I think my desktop is x64 whereas my laptop is x86 (and that's where it works fine).
donnyh13 Posted October 16, 2023 Posted October 16, 2023 (edited) You mention your Desktop is Windows 10, but what is your laptop? I've seen program names change (slightly) between windows versions before. — Just a thought. Edit, not a fix, but you may want to put quotes around the file path for Run? Run doesn't like paths with spaces. Like this. Local $PID, $hHandle, $iResult ConsoleWrite("ScriptBegin" & @CRLF) $PID = Run('"C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe"') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $PID = ' & $PID & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $hHandle = WinWaitActive("Power Automate", "", 10) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hHandle = ' & $hHandle & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $hHandle = WinMove("Power Automate","",0,0) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hHandle = ' & $hHandle & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iResult = WinSetState("Power Automate","", @SW_MAXIMIZE) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iResult = ' & $iResult & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iResult = MouseClick("left",571,253,1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iResult = ' & $iResult & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Exit Edited October 16, 2023 by donnyh13 LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
Somerset Posted October 16, 2023 Posted October 16, 2023 (edited) You running the same OS on both computers? Have you put this at the top of your script --> #RequireAdmin A script on my windows 7 would not work on windows 10 do that not being there. Edited October 16, 2023 by Somerset
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now