Leaderboard
Popular Content
Showing content with the highest reputation on 12/05/2017 in all areas
-
I made this a while ago as part of a one off application, I've stripped it out of my app and put it as a general reg key system. You can have it as a license key system or a license keyed trial software or just a time limited trial. All it does is encrypt the license data and store it in an ini file which is cunningly disguised as a dll file, if you were to open the dll in notepad it just looks like jibberish. If using the trial software option and the user puts the date back then the software will expire the next time validation is ran. It is an idea to periodically run the validation fuction during the day or before a specific function in your application, this also nags the user that it is evaluation software on trial. Just thought it might be useful for someone. Chris Edit: New Version of the trial software attached. Added the ability to make the reg code optional and have just a trial period Previous downloads 435 KeyGen.au3 TrialSoftware.au31 point
-
There is certainly a more clever way to do this ... #include <INet.au3> $ini = @scriptdir & "\temp.ini" $initxt = _INetGetSource("https://docs.google.com/document/d/1JV1s3IueHLW6jMlCV_FSd0D8CBS-IpkS5b81VpZCmkk/edit?usp=sharing") $initxt = StringRegExpReplace($initxt, '(?s).*?og:description" content="([^"]+).*', "$1") $initxt = StringReplace($initxt, ''', "'") $initxt = StringReplace($initxt, ' ', @crlf) FileWrite($ini, $initxt) Local $url1 = IniRead($ini, 'Server', 'name', "") MsgBox($MB_SYSTEMMODAL, "the Server name is", $url1) Local $url2 = IniRead($ini, 'Username', 'name', "") MsgBox($MB_SYSTEMMODAL, "the username is", $url2) Local $url3 = IniRead($ini, 'Pass', 'name', "") MsgBox($MB_SYSTEMMODAL, "the password is", $url3)1 point
-
COM error handling in a UDF - best practice?
pixelsearch reacted to water for a topic
Example: You define a global COM error handler to grab all COM errors occurring in the main script. A local COM error handler grabs all COM errors occurring inside a function. When the function ends the local COM error handler is dropped and the global COM error handler is active again. Global $oGlobalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncGlobal") ; Global COM error handler Global $oIE = ObjCreate("InternetExplorer.Application") $oIE.xyz FunctionLocal() $oIE.xyz Exit Func FunctionLocal() Local $oLocalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncLocal") ; Local COM error handler $oIE.xyz EndFunc ; Global COM error handler Func _ErrFuncGlobal($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> Global COM error handler - COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc ; Local COM error handler Func _ErrFuncLocal($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> Local COM error handler - COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc1 point -
Autoit script at Windows 10 startup (before logon)
argumentum reacted to careca for a topic
Im kind of a hack myself, so i think i would rewire the KB internally in such a way that scroll lock becomes num lock, then activate in bios num lock ON at boot. Huh but im not sure it would work, now that i think about it. Anyway what kind of KB only turns on when you press scroll lock? that's weird.1 point -
Here is an easier one. ;#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> ; Modified from https://www.autoitscript.com/forum/topic/131438-how-to-set-a-bitmap-into-a-pic-control-using-a-bitmap-handle/?do=findComment&comment=915168 Local $width = 100, $height = 100 ;_GDIPlus_Startup() Local $hGUI = GUICreate("Test", 320, 256) Local $idPic = GUICtrlCreatePic("", 50, 50, $width, $height) Local $hBmp = _ScreenCapture_Capture("", 100, 100, $width + 100, $height + 100) ; Create_Bitmap(100, 100) Local $STM_SETIMAGE = 0x0172 GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBmp) _WinAPI_DeleteObject($hBmp) ;_GDIPlus_Shutdown() GUISetState() While 1 Switch GUIGetMsg() Case -3 ; $GUI_EVENT_CLOSE = -3 ExitLoop Case $idPic MsgBox(0, "Test", "Picture was clicked!") EndSwitch WEnd1 point
-
Click on them for help file and examples, those two will let you Send keystrokes when a HotKeySet is pressed....1 point
-
1 point
-
Changing value by using GUI
Viperking123 reacted to careca for a topic
You'll want to create a structure with functions that act on the press of those buttons to read the input and translate that to a variable, to be then used in the mouseclick and whatnot. Same for the color, the issue will be you separating the coordinates, i would create another input, one for X other for Y. As for the pgup pgdn, that's easy enough too. We'll get to that later. here's a sample, so you can try to figure it out. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;============================================================================= #Region ;Include + Opt #include <File.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 0) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) #EndRegion ;Include + Opt ;============================================================================= #Region ;GuiVars Local $GUI, $Frm_main, $Button1, $Button2, $Input1, $Input2, $Radio1, $Checkbox1, $ReadIP1 ;TrayVars Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;MiscVars Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim #EndRegion ;GuiVars ;============================================================================= #Region ;GUI TraySetIcon("ico.ico") $GUI = GUICreate("Form1", 615, 437, 192, 124) $Input1 = GUICtrlCreateInput("Coords", 32, 16, 81, 21) $Input2 = GUICtrlCreateInput("Color", 128, 16, 81, 21) $Radio1 = GUICtrlCreateRadio("PGUP", 40, 200, 113, 17) $Checkbox1 = GUICtrlCreateCheckbox("", 40, 232, 97, 17) $Button1 = GUICtrlCreateButton("Change", 32, 40, 57, 17) GUICtrlSetOnEvent($Button1, "ChangeCoords") ;Jump to function at press $Button2 = GUICtrlCreateButton("Change", 128, 40, 49, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") GUISetState() TraySetState(1) TraySetClick(8) #EndRegion ;GUI ;============================================================================= Do ;Main Sleep(100) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func ChangeCoords() $ReadIP1 = GUICtrlRead($Input1) ;Get the text on the input MsgBox(64, 'Result', $ReadIP1) EndFunc ;==>ChangeCoords ;============================================================================= #Region ;Window Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit #EndRegion ;Window ;=============================================================================1 point -
Save position where is mouse then click
Viperking123 reacted to careca for a topic
Well there's GUIGetCursorInfo() And other functions that give you X and Y coordinates, store to variable, then mouseclick.1 point -
.NET Common Language Runtime (CLR) Framework
antonioj84 reacted to ptrex for a topic
@antonioj84 , The compression will propably be the same since the ZIP.AU3 using the same windows build in classes. The ZIP.AU3 UDF use the traditional COM approach, while the .NET version use the CLR framework to access the classes. The main difference will be speed I guess... where the CLR might win over tradinational COM approach. You can do a simple test to compress using both approaches and compress speed and compression rate... easy to find out.1 point -
Output ConsoleWrite to a GUI Control?
ponty reacted to JLogan3o13 for a topic
I typically use an Edit control, with $ES_READONLY. I then do something like this: _GUICtrlEdit_AppendText($editProgress, @CRLF) _GUICtrlEdit_AppendText($editProgress, @TAB & @TAB & "===============Search Complete===============")1 point -
#include <Array.au3> #include <AutoITConstants.au3> ;From JLogan3o13 @ https://www.autoitscript.com/forum/topic/191287-search-wmic-for-installed-software/ Local $sAppName, $oWMI, $aSystem, $ComputerList = @ScriptDir & "\ComputerNames.txt", $LogFile = @ScriptDir & "\LogFile.txt", $sPC = FileReadToArray($ComputerList) _ArrayDisplay($sPC) ;Debug If Not FileExists($ComputerList) Then MsgBox(48, "Error", "Missing the computer list file : " & @CRLF & $ComputerList & @CRLF & @CRLF & "Please make sure it exist then run the script again.") Exit EndIf FileWriteLine($LogFile, @CRLF) FileWriteLine($LogFile, @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & " Software Check Started" & @CRLF) ;$sPC = "<Computer Name>" $sAppName = ".Net" For $i = 0 To UBound($sPC) - 1 If Ping($sPC, 2000) Then $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sPC[$i] & "\root\cimv2") If IsObj($oWMI) Then $aSystem = $oWMI.ExecQuery("Select * from Win32_Product") For $oApp In $aSystem ;If StringInStr($oApp.Name, $sAppName) Then ConsoleWrite($sPC[$i] & "Application: " & $oApp.Name & "Version: " & $oApp.Version & @CRLF) If StringInStr($oApp.Name, $sAppName) Then FileWriteLine($LogFile, $sPC[$i] & "," & $oApp.Name & "," & $oApp.Version & @CRLF) Next Else ;ConsoleWrite("Unable to connect to WMI on " & $sPC[$i] & @CRLF) FileWriteLine($LogFile, $sPC[$i] & "," & "Offline" & @CRLF) EndIf EndIf Next1 point
-
.... Just for the record, (for those who can be interested) The DOM's window object, has some methods that you can easly call from within AutoIt (https://msdn.microsoft.com/en-us/library/ms535873(v=vs.85).aspx) One of this methods is setTimeout that allows you to execute a function or javascript code after an interval of time expressed in milliseconds. Well this is very interesting because it also allows you to execute chunks of javascript code passed as a string (of course the interesting is that you can pass the javascript code from within AutoIt). Also, if you set the timeout to 0, the code you passed is executed immediately. In my opinion, this method can be a perfect replacement of the execScript method no longer supported starting with IE11. Replacing this safer method in this snippet by @genius257 we can reference and call the eval Javascript function from within AutoIt, allowing interesting interaction between the two worlds (IE+javascript and AutoIt) here a simple and little example just to show what I'm talking about. #include <ie.au3> Local $oIE = _IECreate() Local $oDocument = _IEDocGetObj($oIE) Local $oWindow = $oDocument.ParentWindow ; I'm not been able (for now) to directly refeence the Javascript Global Object from within AutoIt ; anyway it can be referenced via the following JSglobal javascript variable accessed from AutoIt via the eval method $oWindow.setTimeout("JSglobal = (1,eval)('this');", 0) ; a reference to the JavaScript Global Object ; the following JSeval variable will be referenced directly from AutoIt (see below) $oWindow.setTimeout("document.body.JSeval = eval;", 0) ; a reference to the eval method Sleep(2000) ; give a little time to the browser to create above variables within the javascript environment. $eval = $oIE.Document.body.JSeval ; a reference to the eval javascript method from within AutoIt MsgBox(0, "Debug", "The $eval variable is of type " & VarGetType($eval) & @CRLF & "and is a refernce to the eval javascript method") ; Using the Javascript Global Object via eval ; https://docs.microsoft.com/en-us/scripting/javascript/reference/global-object-javascript MsgBox(0, "Debug", "Script infos:" & @CRLF & _ "-------------" & @CRLF & _ "Script Engine: " & $eval('JSglobal.ScriptEngine()') & @CRLF & _ "Script Version: " & $eval('JSglobal.ScriptEngineBuildVersion()')) ; calling javascript methods ; we use a javascript method to format a number ; and we get the result from javascript directly in an AutoIt variable by the javascript eval method $i = 1000000 ; an unformatted number Local $result = $eval('parseInt( ' & $i & ' ).toLocaleString();') MsgBox(0, "Debug", "This is a number formatted by javascript: " & $result) $eval("alert('Bye from JavaScript... see you later\nClick OK to quit')") _IEQuit($oIE)1 point
-
Google chrome extension
Earthshine reacted to guinness for a topic
I said yes, but you also need to understand HTML and CSS. This tutorial explains it all https://developer.chrome.com/extensions/getstarted1 point -
In case of 2 variables with same name the 2nd value overwrites the 1st one... strange syntax But regex doesn't care about the syntax accuracy #Include <Array.au3> $str = '{"Brayan":{"id":53192745,"name":"Brayan","profileIconId":636,"age":30,"something":1437402511000,"something":18975}}' $str = StringReplace($str, '"', "") $res = StringRegExp($str, '(?:id|name|age|something):([^\{,}]+)', 3) _ArrayDisplay($res)1 point
-
Multi threaded dll created in freebasic. From time to time people as for multi threading in AutoIt. Although I think it would be cool to have the ability of launching code in a new thread I do not think it will happens before someone steps up and are prepared to practically create a new AutoIt code base. I say this because I have read what better informed people than me are saying about the subject. Anyhow, you have this killer idea whom really needs to be done asynchronously what do you do? You write it in C/C++, VB or you can, do it as done in this sample, write it in freebasic. Why would you do it in two languages rather than one. Probably because AutoIt is pretty nice for what it does best, act as the glue between your code and windows applications. You maybe have experience in creating simple GUI's in AutoIt. And the fileinstall function is probably the simplest way you can have your small utilities wrapped up in one exe. No install hazel. Enough said. Her is a sample multithreaded dll written in freebasic version 0.15. The sample consist of 4 files. 1: The dll code 2: A dll interface definition to be used with freebasic applications. 3: A freebasic test application. 4: A AutoIt v3 Beta 118 application You will also find all files, including compiled dll and freebasic test app, in a attached zip file at the bottom of this post. The dll: thdll.bas ' FILENAME: thdll.bas ' COMPILE: fbc -dll thdll.bas ' PURPOSE: Demonstrate a multithreaded dll created with freebasic ' Include is not suposed to be used when we compile as dll ??? #include once "thdll.bi" dim shared gState as integer ' Status reflecting the job done in the thread dim shared gRun as integer ' Flag telling the thread to run or quit dim shared gCalls as integer ' Counting call's to this api dim gTH as integer ' Thread handel ID dim gMutexID as integer ' mutex id to be used when shared variables are updated. ' ' PURPOSE: Test calling conventions from application function AddNumbers CDECL(byval operand1 as integer, byval operand2 as integer) as integer export Return (operand1 + operand2) end function ' ' PURPOSE: Function to run in seperate tread. SUB mythread CDECL ( byval mutexID as integer ) ' Do some realy lengthy woork While gRun = 1 mutexlock(mutexID) ' Use mutex to lock memmory before update gState = gState + 1 mutexunlock(mutexID) 'print "gState:="; gState Sleep(1000) Wend END SUB ' ' PURPOSE: Start a thread FUNCTION Startit CDECL () AS INTEGER export gState = 0 gCalls +=1 gRun = 1 gMutexID = mutexcreate() gTH=threadcreate(@mythread, gMutexID) dim ret as integer ret = gTH Startit = ret END FUNCTION ' ' PURPOSE: Stop the thread FUNCTION Stopit CDECL () AS INTEGER export gCalls +=1 gRun = 0 if gTH <> 0 Then threadwait(gTH) mutexdestroy(gMutexID) Endif gTH = 0 Stopit = 1 END FUNCTION ' ' PURPOSE: Get a simple status message regarding the thread FUNCTION Status CDECL () AS INTEGER export Dim ret as integer gCalls +=1 mutexlock(gMutexID) ret = gState mutexunlock(gMutexID) 'print "Status gState:="; gState Status = ret END FUNCTION function Calls CDECL () as integer export Calls = gCalls end function The interface file thdll.bi 'FILENAME: th.bi 'PURPOSE: Declarations for exported functions in thdll.bas ' 'NOTE: I got weired results before I did it all from scratch and aded on function, on declaration ' testcode in the runer and compiled. Did that until all functions were added. ' So I suspect that you can get in trouble if the function sequence in this file does not follow ' the sequence in the dll file. BUT I'M NOT SERTAN! declare function AddNumbers CDECL lib "thdll" alias "AddNumbers" ( byval operand1 as integer, byval operand2 as integer ) as integer declare FUNCTION Startit CDECL lib "thdll" alias "Startit" () AS INTEGER declare FUNCTION Stopit CDECL lib "thdll" alias "Stopit" () AS INTEGER declare FUNCTION Status CDECL lib "thdll" alias "Status" () AS INTEGER declare FUNCTION Calls CDECL lib "thdll" alias "Calls" () AS INTEGER The freebasic test application (console): thrun.bas 'FILENAME: thrun.bas 'COMPILE: fbc thrun.bas 'PURPOSE: test functionality in thdll.bas 'USAGE: Run in command box. thdll.dll must be in path (same folder) #include "thdll.bi" ' Include file containing dll api interface randomize timer x = rnd * 10 y = rnd * 10 print x; " +"; y; " ="; AddNumbers( x, y ) dim nTh as integer nTh = Startit() 'Starting the thread while n <= 10 'Let it work for a while print "Status:="; Status() sleep(333) Wend nTh = Stopit() 'Stop the thread print "Finished : "; Status(); Calls() The AutoIt test application: thrun.au3 ;FILENAME: thrun.au3 ; ;mutithreaddll runner local $dllfilename = @ScriptDir & "\" & "thdll.dll" local $dll = DllOpen($dllfilename) local $ret if $dll = - 1 then msgbox(16, "ERROR", "Could not load dll " & $dllfilename) Else MsgBox(0,"ADDNUMBERS","Just a dll call test" & @CRLF & "2 + 2 = " & apiAddNubers(2, 2)) apiStartit() while (apiStatus() < 20) ConsoleWrite(apiStatus() & " - ") sleep(900) Wend MsgBox(0,"FINISHED","Loop finished: status():=" & apiStatus()) EndIf exit Func OnAutoitExit() msgbox(0,"TERMINATING", "OnAutoitExit") apiStopit() if $dll <> -1 then DllClose($dll) endif EndFunc Func apiStartit() Local $ret = dllcall($dll, "int","Startit") Local $err = @error if $err <> 0 then DllError($err) EndIf Return $ret[0] EndFunc Func apiStopit() Local $ret = dllcall($dll, "int", "Stopit") Local $err = @error if $err <> 0 then DllError($err) EndIf Return $ret[0] EndFunc Func apiStatus() Local $ret = dllcall($dll, "int", "Status") Local $err = @error if $err <> 0 then DllError($err) EndIf Return $ret[0] EndFunc Func apiAddNubers($arg1, $arg2) Local $ret = dllcall($dll , "int", "AddNumbers", "int", $arg1, "int", $arg2) Local $err = @error if $err <> 0 then DllError($err) $ret = -1 EndIf Return $ret[0] EndFunc Func DllError($err) Local $errMessage switch $err case 1 $errMessage = "Unable to use the DLL file" case 2 $errMessage = "unknown return type" case 3 $errMessage = "function not found in the DLL file" case Else $errMessage = "Unknow error number: " & $err EndSwitch msgbox(16, "DllError", "Error occured" & @CRLF & $errMessage) EndFunc Happy coding, Uten thdll.zip1 point
-
This script is supposed to be a working sample of communication through stdin and stdout between parent and child processes. If you want to run the child as a script sample you have to compile this IOChatter to a a3x file. You can run this sample directly from scite with ALT+F5 The script is attached below. ; FILENAME: IOChatter.au3 ; PURPOSE: Demonstrate usage of stdin and stdout communication between ; Parent and child process in AutoIt. ; This is demonstrated through this simple chat script. ; The script was created and tested on: @AutoItVersion:= 3.1.1.116 ; ; CREATED BY: Uten: http://www.autoitscript.com/forum/index.php?showuser=7836 ; #include <GuiConstants.au3> #include <constants.au3> dim $a3x = "IOChatter.a3x" Dim $gChildPid Dim $gParent = 0 Dim $data Dim $GUI_Handle = GuiCreate("IO chat Base", 426, 251,(@DesktopWidth-426)/2, _ (@DesktopHeight-251)/2) Dim $input1 = GuiCtrlCreateInput("Message from", 10, 10, 350, 20) Dim $edit1 = GuiCtrlCreateEdit("Started: " & @HOUR & ":" & @Min & ":" & @SEC , 10, 40, 350, 180) Dim $label1 = GUICtrlCreateLabel("INIT: ", 10,222, 350, 28) Dim $buttonSend = GuiCtrlCreateButton("Send", 370, 10, 50, 30) DIm $checkRunIntern = GUICtrlCreateCheckbox("Script", 370, 45, 50, 30) GUICtrlSetTip($checkRunIntern, "If checked the childe will be started with:" & _ @CRLF & " @AutoitExe /AutoIt3ExecuteScript " & $a3x) Dim $buttonRunChild = GuiCtrlCreateButton("Run Child", 370, 80, 50, 30) GuiSetState() While 1 $msg = GuiGetMsg() Switch $msg case $GUI_EVENT_CLOSE ExitLoop case $buttonSend buttonSend_Event() case $buttonRunChild buttonRunChild_Event() Case Else ;Read IO $data = ReadIO($gChildPid) if $data <> "" Then GUICtrlSetData($edit1, (GUICtrlRead($edit1) & @CRLF & $data)) Endif sleep(50) EndSwitch WEnd Exit ; ============================================ Func buttonRunChild_Event() $gParent = 1 if GUICtrlRead($checkRunIntern) = $GUI_CHECKED Then if FileExists(@AutoItExe) AND FileExists(@ScriptDir & "\" & $a3x) Then LogMsg("cmd run( " & @AutoItExe & " /AutoIt3ExecuteScript " & _ @ScriptDir & "\" & $a3x & ")") $gChildPid = run(@AutoItExe & " /AutoIt3ExecuteScript " & @ScriptDir & _ "\" & $a3x, '', _ @SW_SHOW, $STDOUT_CHILD + $STDIN_CHILD);$STDERR_CHILD + Else ; Give error message, this is not suposed to happen msgbox(16, "ERROR:", "could not locate: " & @CRLF & @AutoItExe & _ " OR " & @CRLF & _ @ScriptDir & "\" & $a3x & @CRLF & @CRLF & _ "Did jo remember to compile the " & $a3x & " file??") Endif Else If @Compiled Then LogMsg("Running: " & @AutoItExe) $gChildPid = run(@AutoItExe,"",@SW_SHOW, $STDOUT_CHILD + $STDIN_CHILD) ; $STDERR_CHILD nit handeled Else $gChildPid = run(@AutoItExe & " " & @ScriptFullPath,"",@SW_SHOW, $STDOUT_CHILD + $STDIN_CHILD) endif EndIf EndFunc Func buttonSend_Event() WriteIO($gChildPid, GUICtrlRead($input1)) EndFunc ; =========================================== ; Read from the IO stream between the processes ; ============================================ Func ReadIO($childPid) Local $bytes Local $data = "" ; Determine if we are a master or a child If $childPid <> 0 Then ; Peek to see how many bytes to read $bytes = StdoutRead($childPid,'',true ) LogMsg(" NOTE: StdoutRead returned $bytes:=" & $bytes ) if $bytes > 0 then ; Read bytes in the stream $data = StdoutRead($childPid, $bytes) Endif Else ; Peek to see how many bytes to read $bytes = ConsoleRead( '', true) LogMsg(" NOTE: ConsoleRead returned $bytes:=" & $bytes ) if $bytes > 0 then $data = ConsoleRead($bytes) Endif ; Expect @error = -1; EOF or not set. EndIf If @error <> 0 then LogMsg( " ERROR: Read: @error:=" & @error & _ "@ScriptLineNumber:=" & @ScriptLineNumber) Return $data EndFunc ; ====================================== ; Write to the IO stream between the processes ; ======================================= Func WriteIO($childPid = 0, $data = "") Local $bytes if $data <> "" Then If $childPid <> 0 Then ; Peek to see how many bytes to read StdinWrite($childPid, $data) Else ConsoleWrite($data) EndIf If @error <> 0 then LogMsg(" ERROR: Write: @error:=" & @error & _ "@ScriptLineNumber:=" & @ScriptLineNumber) Else LogMsg(" WARNING: Nothing to write") Endif EndIf EndFunc Func LogMsg($msg) GUICtrlSetData($label1, @MIN & ":" & @SEC & $msg ) EndFuncIOChatter.au31 point