gal9 Posted October 11, 2022 Share Posted October 11, 2022 (edited) Hi everyone I have a script that gets two parameters. After AutoIt finishes, I try to send a string to my python script with ConsoleWrite ( ) but I get nothing. and when i send from cmd I get nothing. Edited October 11, 2022 by gal9 Link to comment Share on other sites More sharing options...
Danyfirex Posted October 11, 2022 Share Posted October 11, 2022 Hello, Could you show a sample script about how you're doing it? Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
gal9 Posted October 12, 2022 Author Share Posted October 12, 2022 (edited) 23 hours ago, Danyfirex said: Hello, Could you show a sample script about how you're doing it? Saludos expandcollapse popup#include <Constants.au3> #include <Array.au3> ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: Jonathan Bennett (jon at autoitscript dot com) ; Modified: mLipok ; ; Script Function: ; Opens Notepad, types in some text and then quits the application. ; If Not $CmdLine[0] Then Exit Run(@AutoItExe & " " & @ScriptFullPath & " /Allow Adobe Flash /param2 disable") MsgBox(4096, "message", "Validation verified "& $CmdLine[1] & " set to " & $CmdLine[2] & " This box will time out in 8 seconds", 8) Sleep(5000) Local $mtric =$CmdLine[1] ; "Allow Adobe Flash" Local $setting = $CmdLine[2] ;"disable" Local $settingValidation =_Validation($mtric,$setting) ConsoleWrite ( "data" ) ConsoleWrite ( $settingValidation ) Exit(1) ; Finished! Func _Validation($mtric,$setting) Run("c:\Windows\system32\mmc.exe C:\Users\gal.dahan\Desktop\script\gpedit_v1.msc /a") Sleep(2500) WinWaitActive("[CLASS:MMCMainFrame]") Sleep(500) Send("{ALT}{A}{O}") While ControlGetFocus("[TITLE:Filter Options]") = "" sleep(1) WEnd WinWaitActive("[TITLE:Filter Options]") Sleep(3500) If ControlCommand("Filter Options", "Enable &Keyword Filters", "Button2", "IsChecked", "") = 0 Then Send("{ALT down}{K}{F}{ALT up}") Else Send("{ALT down}{F}{ALT up}") EndIf Sleep(3500) ;;Type search Send($mtric) Sleep(3500) Send("{ENTER}") Sleep(5500) Send("{tab}{down 1}{ENTER}") Sleep(2000) Send("{down 2}{ENTER}") Sleep(4000) Sleep(1500) Local $sText = WinGetTitle("[ACTIVE]") Local $settingValidation= "" If $setting = "disable" Then $settingValidation=" not set to disable" If ControlCommand($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15", "Check", "") = 0 Then $settingValidation=" set to disable" Sleep(2000) EndIf EndIf If $setting = "enabled" Then $settingValidation=" not set to enabled" If ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", "") = 1 Then $settingValidation=" set to enabled" EndIf EndIf Send("{ENTER}") Send ("{Ctrl}{S}") Send("^s") ;_Validation($mtric,$setting) WinWaitActive("[CLASS:MMCMainFrame]") Send("{ALT down}{F4}{ALT up}") Sleep(2000) ; Display the window title. MsgBox(4096, "", $sText& " Validation verified "&$settingValidation, 8) Return $settingValidation Exit(1) EndFunc after I call _Validation ConsoleWrite ( "data" ) ConsoleWrite ( $settingValidation ) try string or variable not work.... how I get this from python? Edited October 12, 2022 by gal9 Link to comment Share on other sites More sharing options...
gal9 Posted October 25, 2022 Author Share Posted October 25, 2022 anyone? Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 When you run your AutoIt script from Scite, does the consolewrite data show up in the output box at the bottom? If so, then the problem is with Python and i'd suggest doing some google searches for "Python Read STDOUT" Link to comment Share on other sites More sharing options...
gal9 Posted October 25, 2022 Author Share Posted October 25, 2022 2 minutes ago, BigDaddyO said: When you run your AutoIt script from Scite, does the consolewrite data show up in the output box at the bottom? If so, then the problem is with Python and i'd suggest doing some google searches for "Python Read STDOUT" but i dont see in cmd the STDOUT Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 Try switching your Consolewrite to ConsoleWriteError I believe the cmd shows STDERR Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 I just put together a quick test, and you are correct. consolewrite and consolewriteError don't display when running a script from cmdline. I did output the return to a file using > output.txt and it did create the output.txt with the contents of the consolewrite line so the STDOUT is there it's just not displaying on the screen. Link to comment Share on other sites More sharing options...
gal9 Posted October 25, 2022 Author Share Posted October 25, 2022 Just now, BigDaddyO said: I just put together a quick test, and you are correct. consolewrite and consolewriteError don't display when running a script from cmdline. I did output the return to a file using > output.txt and it did create the output.txt with the contents of the consolewrite line so the STDOUT is there it's just not displaying on the screen. I think I'll work with writing to a file. Can you help me on this topic Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 25, 2022 Share Posted October 25, 2022 The data you want from the consolewrite IS in the stdout stream, you just need to update your python code to read it. I don't use Python, but perhaps this will help. https://www.cyberciti.biz/faq/python-run-external-command-and-get-output/ Link to comment Share on other sites More sharing options...
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