Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. Hi Melba23 thanks for your reply, I read the book you recommend, I want to built an app that runs some cmd commands and outputs the result in a GUI.
  3. zoel, Which AutoIt book did you read? I would recommend this one: Other than that, what would you like to do with AutoIt? If you have a specific goal in mind it is much easier to understand the limited number steps you need to do it, rather then facing the entire AutoIt function list and being completely bewildered. Over to you. M23
  4. Hi people, as the title suggests I don't understand nothing, I just finished the AutoIT book but I didn't understand nothing, I think programming is not for me, should I giveup? Ho you people learned how to code, do you haveany advices. Thanks in advance!!
  5. This works for me If ProcessExists($PID) Then While ProcessExists($PID) ProcessClose($PID) WEnd StdioClose($PID) EndIf Seems like StdioClose must be called to flush the stream, and processclose alone does not ensure that process is closed when StdioClose is called, so fragments pile up. Ensure that process is closed before the StdioClose call seems to fix this. Whole modified script ; *** Start added by AutoIt3Wrapper *** #include <AutoItConstants.au3> ; *** End added by AutoIt3Wrapper *** #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> $loops = 0 $CleanupRAM = False $aWS = ProcessGetStats() $WSram = $aWS[0] $WSramPeak = $aWS[1] $xMax = 9999 $yMax = 99 Dim $aTest[$xMax + 1][$yMax + 1] AdlibRegister(UpdToolTip) $PID = False $sOutput = "" $GrabOutput = True While 1 If _IsPressed("7B") Then If $GrabOutput = False Then $GrabOutput = True Else $GrabOutput = False EndIf Sleep(100) EndIf $RandX = Random(0, $xMax, 1) $RandY = Random(0, $yMax, 1) $aTest[$RandX][$RandY] = $RandX * $RandY * Random(1, 100) If ProcessExists($PID) Then While ProcessExists($PID) ProcessClose($PID) WEnd StdioClose($PID) EndIf If $GrabOutput Then $PID = Run(@ComSpec & " /c echo hello", @TempDir, @SW_HIDE, $STDERR_MERGED) Else $PID = Run(@ComSpec & " /c echo hello", @TempDir, @SW_HIDE) EndIf $loops += 1 WEnd Func UpdToolTip() $sResult = "Loops: " & $loops & @CRLF $aWS = ProcessGetStats() $WS_TXT = " WorkingSetSize (4k)= " & Round($aWS[0] / 1024 / 4, 2) & @CRLF & "PeakWorkingSetSize (4k)= " & Round($aWS[1] / 1024 / 4, 2) & @CRLF & _ "RAM Delta 4k pages : " & Round(($aWS[0] - $WSram) / 1024 / 4, 2) & @CRLF & _ "Peak Delta 4k pages : " & Round(($aWS[1] - $WSramPeak) / 1024 / 4, 2) If $CleanupRAM Then DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1) $aWS = ProcessGetStats() $WS_TXT &= @CRLF & _ "RAM Delta (after cleanup) = " & Round(($aWS[0] - $WSram) / 1024 / 4, 2) & @CRLF & _ "Peak Delta (after cleanup) = " & Round(($aWS[1] - $WSramPeak) / 1024 / 4, 2) EndIf $WSram = $aWS[0] $WSramPeak = $aWS[1] If $GrabOutput Then ToolTip($WS_TXT & @CRLF & $sResult & @CRLF & "With $STDERR_MERGED", 500, 100, "Random Array Fill, loops: " & $loops) Else ToolTip($WS_TXT & @CRLF & $sResult & @CRLF & "Without $STDERR_MERGED", 500, 100, "Random Array Fill, loops: " & $loops) EndIf EndFunc ;==>UpdToolTip
  6. matwachich, You are not quite alone as you can see here. I have tweaked the positions a bit - how does this seem to you? ExtMsgBox_Mod.au3 M23
  7. use the UNC path instead of the mapping ( https://forums.virtualbox.org/viewtopic.php?f=7&t=40036 )
  8. you are running from SciTE, try to run the script from the command line, and see if the same happens.
  9. @TheDcoder Did you try to disable UAC (temporarily)? Your issue seems something (but could not) related to UAC, as stated here
  10. Thanks Sidley To be fair I did cheat a little bit with the text offset - changing the font size/type face may slightly throw the alignment. By rights I probably should've used _GDIPlus_GraphicsMeasureString to find the measurements of the bounding box, then calculate an offset off that. Matt
  11. Hi everyone, Ever since I have switched to Linux, I have been using Windows in a virtual machine so that I can use AutoIt and some other software which only runs on Windows. Suddenly since yesterday my AutoIt scripts inside shared drives (which are simulated shared folders by VirtualBox) have stopped working... they were working fully before! No errors, warnings, messages or crashes. AutoIt.exe just exits with a 0 exit code . Here is a test script which does not work: #include <MsgBoxConstants.au3> If MsgBox($MB_YESNO, "Test", "Is it working?") = $IDYES Then ConsoleWrite("It is working!") Else ConsoleWrite("It does not work...") EndIf ConsoleWrite(@CRLF) >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "W:\Test.au3" /UserParams +>10:40:43 Starting AutoIt3Wrapper v.18.708.1148.0 SciTE v. Keyboard:00004009 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\John Doe\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\John Doe\AppData\Local\AutoIt v3\SciTE >Running AU3Check ( from:C:\Program Files (x86)\AutoIt3 input:W:\Test.au3 +>10:40:44 AU3Check ended.rc:0 >Running:(\Program Files (x86)\AutoIt3\autoit3.exe "W:\Test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop +>10:40:44 AutoIt3.exe ended.rc:0 +>10:40:44 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.051 The same script does work if I copy it to a normal drive (in my case I copied it to the Desktop which is inside the C drive) This is a really strange issue, did anyone experience this before? Maybe we will need the expertise of the AutoIt Devs with this one... Thanks for the help in advance!
  12. #include just concatenates source files. Hence the final script source is only one solid block without mention of who's who, so you can't know at runtime which source file the current excuting line belongs to.
  13. PyAutoGUI looks like a neat piece of library for python, it has functions for MsgBox and Screenshots too But I believe it is not relevant in this topic as it is not about having a cross-platform automation toolkit... maybe I should change the name of the topic to mention the AutoIt language specifically? Edit: Done!
  14. Hello, I cannot find how to get the path of the current running script when is included from another file, I am always getting the path of the caller script: script1.au3 #include "folder\script2.au3" ConsoleWrite("From script1:" & @CRLF) ConsoleWrite(" @ScriptDir = " & @ScriptDir & @CRLF) ConsoleWrite(" @WorkingDir = " & @WorkingDir & @CRLF) ConsoleWrite(" @ScriptFullPath = " & @ScriptFullPath & @CRLF) ConsoleWrite(@CRLF) FromScript2() Exit script2.au3 #include-once Local Const $ScriptDir = @ScriptDir Local Const $WorkingDir = @WorkingDir Local Const $ScriptFullPath = @ScriptFullPath Func FromScript2() ConsoleWrite("From script2:" & @CRLF) ConsoleWrite(" @ScriptDir = " & @ScriptDir & @CRLF) ConsoleWrite(" @WorkingDir = " & @WorkingDir & @CRLF) ConsoleWrite(" @ScriptFullPath = " & @ScriptFullPath & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite(" $ScriptDir = " & $ScriptDir & @CRLF) ConsoleWrite(" $WorkingDir = " & $WorkingDir & @CRLF) ConsoleWrite(" $ScriptFullPath = " & $ScriptFullPath & @CRLF) EndFunc Output: From script1: @ScriptDir = C:\test_suite\autoit @WorkingDir = C:\test_suite\autoit @ScriptFullPath = C:\test_suite\autoit\script1.au3 From script2: @ScriptDir = C:\test_suite\autoit @WorkingDir = C:\test_suite\autoit @ScriptFullPath = C:\test_suite\autoit\script1.au3 $ScriptDir = C:\test_suite\autoit $WorkingDir = C:\test_suite\autoit $ScriptFullPath = C:\test_suite\autoit\script1.au3 What I am looking for: From script1: $ScriptDir = C:\test_suite\autoit From script2: $ScriptDir = C:\test_suite\autoit\folder Thanks in advance!
  15. Yesterday
  16. Update. After more troubleshooting i found a combo-box items only generate it's list after it has been opened. A workaround for this is the code below which opens / closes the combo but doesn't take focus. ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "cmbAddressType", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pComboBox1, $oComboBox1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition0, $pComboBox1 ) $oComboBox1 = ObjCreateInterface( $pComboBox1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oComboBox1 ) Then Return ConsoleWrite( "$oComboBox1 ERR" & @CRLF ) ConsoleWrite( "$oComboBox1 OK" & @CRLF ) Local $pInvoke, $oInvoke $oComboBox1.GetCurrentPattern( $UIA_LegacyIAccessiblePatternId, $pInvoke) $oInvoke = ObjCreateInterface( $pInvoke, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtagIUIAutomationLegacyIAccessiblePattern ) If Not IsObj( $oInvoke ) Then Return ConsoleWrite( "$oInvoke ERR" & @CRLF ) ConsoleWrite( "$oInvoke OK" & @CRLF ) $oInvoke.DoDefaultAction() $oInvoke.DoDefaultAction() I also found using the Legacy Select lets me select my item without taking focus. I don't know why it needed the number 3 but without it didn't work ^^. ;Find List Item Local $pCondition4 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Do it later", $pCondition4 ) If Not $pCondition4 Then Return ConsoleWrite( "$pCondition4 ERR" & @CRLF ) ConsoleWrite( "$pCondition4 OK" & @CRLF ) Local $pListItem1, $oListItem1 $oComboBox1.FindFirst( $TreeScope_Children, $pCondition4, $pListItem1 ) $oListItem1 = ObjCreateInterface( $pListItem1, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If Not IsObj( $oListItem1 ) Then Return ConsoleWrite( "$oListItem1 ERR" & @CRLF ) ConsoleWrite( "$oListItem1 OK" & @CRLF ) Local $pInvoke, $oInvoke $oListItem1.GetCurrentPattern( $UIA_LegacyIAccessiblePatternId, $pInvoke) $oInvoke = ObjCreateInterface( $pInvoke, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtagIUIAutomationLegacyIAccessiblePattern ) If Not IsObj( $oInvoke ) Then Return ConsoleWrite( "$oInvoke ERR" & @CRLF ) ConsoleWrite( "$oInvoke OK" & @CRLF ) $oInvoke.Select(3) One random question! Can IUI enable/disable controls similar to ControlEnable/ControlDisable?
  17. Another possible solution. #AutoIt3Wrapper_Change2CUI=y ShellExecute("notepad.exe") Global $g_cbHandler = DllCallbackRegister(_HandlerRoutine, "BOOL", "DWORD") ;~ https://docs.microsoft.com/en-us/windows/console/setconsolectrlhandler DllCall("kernel32", "BOOL", "SetConsoleCtrlHandler", "PTR", DllCallbackGetPtr($g_cbHandler), "BOOL", True) ProcessWaitClose(@AutoItPID) Func _HandlerRoutine($dwCtrlType) ProcessClose("notepad.exe") EndFunc
  18. What I've done to run scripts on executable programs and click-click the windows, is to have a console user auto-login and run my scripts from there. When I need to interact with the session, I shadow it. All this is done in a vm where no one can plug a monitor or keyboard to it, as is a vm. Maybe you can do this setup, and not even worry that the untended PC rebooted or what not, since the session will always run if the vm is turned on. My 2 cents PS: I even wrote me a script to make it simpler ( https://www.autoitscript.com/forum/files/file/477-rdpshadow-utility/ )
  19. No the less, this last post is pretty spot on. Jos
  20. ..I don't mean to be .. that you're thinking. In my view, regarding online stuff, I don't trust blindly any of it. I can not know when a heartbeat bug or a breach will occur. And I can not give more examples, as I could get in trouble by just hinting. I rather have RDP access in house, and as unusual as possible.
  21. I don't try, I say. As far as understanding, I can not make you understand ...and the OP question is answered, so no more chatting on this thread from me.
  22. Don't forget, you can do all of this in Python if you needed to, you only need to import PyAutoGUI to do a lot of the automation you can do in AutoIt. You could make a wrapper for it that mimics AutoIt's functions if you REALLY wanted to.
  23. What CUI are you talking about? The AutoIt hidden window? That's not a "CUI" that's there on every script that gets run, whether or not you use CUI mode or not. The 2 things aren't the same.
  24. ..visually, a CUI, it looks like a window. So the inexperienced may see a window, not knowing that is a different animal altogether.
  25. They are compatible with each other, I've used AdLib function in an OnEvent style script many times.
  26. I don't understand at all what you're trying to say here, or in the comments in your script. BTW, script writers are programmers, don't sell yourself short.
  1. Load more activity
  • Create New...