Leaderboard
Popular Content
Showing content with the highest reputation on 02/27/2021 in all areas
-
Very Simple Inter-Process Communication (using AutoItObject_Internal)
jaberwacky and 3 others reacted to SEuBo for a topic
Hi there, while I created an example script to generate and execute a function during runtime, I stumbled across a neat way to share data between running autoit scripts. This is done using the amazing magic of AutoItObject_Internal . (You'll need at least Version 3.0.0 of AutoItObject_Internal) Using this UDF, you can create a shared data storage, basically an empty "AutoitObject_Internal-"Object which you can then use to write / read data Inline. no set/get methods, just #include "AutoItSharedData.au3" $oShare = _AutoIt_SharedData_CreateOrAttach("MyCustomID") $oShare.some_data = 'foo' and you're done. any other script accessing this data will have to do: #include "AutoItSharedData.au3" $oShare = _AutoIt_SharedData_CreateOrAttach("MyCustomID") ConsoleWrite($oShare.some_data & @LF) Basically it's Larsj's Implementing IRunningObjectTable Interface, but you dont have a Dictionary, but an IDIspatch Object instead. There are already a bunch of IPC options available - and this is another one. AutoItSharedData.au3 Example Script 1 Example Script 2 Output: To test: run Example Script 1, Then run example Script 2.. or the other way around. Example Script 3 Example_sharedata3.au3 Example_sharedata3_Controlsend.au3 Example_sharedata3_Tooltip.au3 To test: run Example_sharedata3.au3. Output: Example SharedData4: Output: /Edit: Please note that there's a limitation with the Running object table : The Script accessing a variable first, will be the "server" for this variable. This means, access to that variable from other scripts should only be possible, as long the "server" script is running! Use appropriate Object Error handlers in case you don't want the surviving "clients" to crash. Feedback and/or improvements appreciated changelog version 2.0 Removed need for AutoItObject, as AutoItObject_Internal now comes with ROT support Added UDF Header Fixed typo on "#include AutoItObjectInternal.au3" -> "#include AutoItObject_Internal.au3" Added ObjGet() after registering the object fails (in case 2 programs tried to register the same ID simultaneously) Updated Examples & zip archive. Cheers, AutoItSharedData.zip4 points -
If you #include a .au3 file in your script, the included file will become part of the 'main' script. - #Include <Filename.au3> is basically just a short way of telling AutoIt to "read text in Filename.au3 and insert all lines here". All files you included with #include will be part of your .exe automatically. How you actually "include" the functionality inside your GUI highly depends on how your function scripts are set up. If they are standalone-scripts, to perform data you could just FileInstall(...) and Run(...) them. Please see the Help File for autoitscript.com/autoit3/docs/intro/running.htm for details. If they are actual function collections, you can just call those functions in your GUI's "Message Loop" - that is where you handle the button clicks. Here's an example of a Script with 2 simple buttons which would call functions from two different include files:3 points
-
New Version. Since AutoItObject Internal now comes with ROT support, I removed the need for AutoItObject. No Dlls anymore, and most notably: 64-Bit support. Archive in first post updated.3 points
-
Additional note : AutoIt already provides a variety of GUI scripts for demonstration purposes. One of them shows the different GUI elements in some sort of collage, see : ..\AutoIt3\Examples\GUI\SampleControls.au3 You will find more, if you take a look in : ..\AutoIt3\Examples\GUI\Advanced\ (all runnable). You may or may not use a form designer like KODA, that is a question of individual preference. I haven't used KODA myself yet, but that doesn't mean it's an unsuitable tool. Feel free to ask further questions before you move in the wrong direction .2 points
-
Version 3.4
1,395 downloads
The CodeScannerCrypterBundle (ca. 2.9 MB unzipped) contains the following UDFs and utilities: CodeScanner: analyse AutoIt script structure and content, identify potential issues, generate MCF data files CodeCrypter: front-end GUI for the MCF library, for script encryption (without storing the decryption key(s) in the script!) MetaCodeFile UDF (MCF library): for analysis and user-defined alterations of AutoIt script structure and content MCFinclude.au3: #include this UDF in any AutoIt script that you wish CodeCrypter to process CryptoNG, by TheXman; encryption UDF using Bcrypt dll calls (32/64-bit; various algorithms) StoreCCprofile.au3/readCSdatadump.au3/helloworld.au3: auxiliary utilities and example script HowToCodeCrypt.pdf: a simple guide in five steps CodeCrypterFAQ.pdf: questions and answers, partly based upon exchanges in the CodeCrypter thread. MetaCodeTutorial.pdf: the MCF engine explained; useful for encryption, GUI translation, code translation, and much more... Please follow the links for additional information.1 point -
I liked the clean interface of the "new" _ArrayDisplay and being able to sort but I missed being able to pick rows and copy them and being able to exit to the script. The _DebugArrayDisplay adds those but doesn't have the sorting. So I wrote an overlaying interface that would add copy, and exit to the existing _ArrayDisplay without actually changing it. It also lets you chose whether you return the row(s) index or the it's value. It's defaults to returning a value but if you'd rather it defaulted to returning an index feel free to change $a = 0 to $a = 1. In the example press "Enter" when you have highlighted your choices, or press esc to return without a choice or press x to exit the script. In the Example swap the commenting on the "$aItemx =" lines to return index(es) instead of values. Note you can still pass all the parameters you would use on the normal _ArrayDisplay. Example: #include "ad_ex.au3" Global $aItem2[4] = ["one", "two", "three", "four"] $aItemx = _ad($aItem2, "Press Enter") ;~ $aItemx = _ad($aItem2, "Press Enter",1) If $aItemx = -1 Then ConsoleWrite("No Pick" & @CRLF) If IsArray($aItemx) Then For $i = 1 To $aItemx[0] ConsoleWrite($aItemx[$i] & @CRLF) Next EndIf ConsoleWrite("Done" & @CRLF) Exit UDF: ;_ArrayDisplay with extras copy and exit keys return index or value ;$array,Title,0 or 1 Return-> 0=value 1=index #include-once #include <array.au3> #include <misc.au3> #include <GuiListView.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ad ; Description ...: Added the ability to return selected rows by index number or value. Exit the script immediately. To the _ArrayDisplay() ; Syntax ........: _ad(Byref $aI[, $t = ""[, $a = 0[, $sArrayRange = ""[, $iFlags = 0[, $vUser_Separator = Default[, ; $sHeader = Default[, $iMax_Colwidth = Default]]]]]]]) ; Parameters ....: $aI - [in/out] array to display ; $t - [optional] Title Default is "". ; $a - [optional] Return Value(0) or Index(1) Default is 0. ; ; Variables below are a pass through of the normal _ArrayDisplay parameters ; ; $sArrayRange - [optional] a string value. Default is "". ; $iFlags - [optional] an integer value. Default is 0. ; $vUser_Separator - [optional] a variant value. Default is Default. ; $sHeader - [optional] a string value. Default is Default. ; $iMax_Colwidth - [optional] an integer value. Default is Default. ; Return values .: Array of either value(s) or index(es) or -1 if there was no pick ; Author ........: Wolflake ; Modified ......: ; Remarks .......:Select your rows press Enter to return you choices. Press x to exit script. Press escape to return without a choice. ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _ad(Const ByRef $aI, $t = "", $a = 0, $sArrayRange = "", $iFlags = 0, $vUser_Separator = Default, $sHeader = Default, $iMax_Colwidth = Default) ;start keychk and arraydisplay ToolTip("Press Enter to copy", 650, 300) Sleep(750) ToolTip("", 500, 300) Global $s AdlibRegister("_ChkKey", 100) ;turn on key checking _ArrayDisplay($aI, $t, $sArrayRange, $iFlags, $vUser_Separator, $sHeader, $iMax_Colwidth) $aItem = _ChkKey($a) ;get the data from picks If Not IsArray($aItem) Then Return -1 If $a = 0 Then ;pull data instead of index For $i = 1 To $aItem[0] $aItem[$i] = $aI[$aItem[$i]] Next EndIf Return $aItem EndFunc ;==>_ad Func _ChkKey($a=0) Static Local $hForm1, $aItem, $dll = DllOpen("user32.dll") If $hForm1 = "" Then $hForm1 = WinGetHandle("[Active]") EndIf If Not WinActive($hForm1) And WinExists($hForm1) Then ; don't run while not active but run to get data Return ;don't check for keys EndIf If _IsPressed("58") Then Exit ; x If _IsPressed("1B", $dll) Then ; esc AdlibUnRegister("_ChkKey") Send("{esc}") Return -1 EndIf If _IsPressed("0D", $dll) Then ; Enter ;get picks, note the control id for the list is 3 AdlibUnRegister("_ChkKey") While _IsPressed("0D", $dll) Sleep(20) WEnd $hlist = ControlGetHandle("[active]", "", "[CLASS:SysListView32; INSTANCE:1]") $aItem = _GUICtrlListView_GetSelectedIndices($hlist, True) ;~ ConsoleWrite("Count " & $aItem[0] & @CRLF) For $i = 1 To $aItem[0] ;~ ConsoleWrite("row " & _GUICtrlListView_GetItemText(3, $aItem[$i]) & @CRLF) ;~ ConsoleWrite("Value " & _GUICtrlListView_GetItemText(3, $aItem[$i],1) & @CRLF) ;~ ConsoleWrite("Index " & $aItem[$i] & " ") $aItem[$i] = StringMid(_GUICtrlListView_GetItemText($hlist, $aItem[$i]), 5) Next ;~ ConsoleWrite(@CRLF) Sleep(100) Send("{esc}") EndIf AdlibRegister("_ChkKey", 100) Return $aItem EndFunc ;==>_ChkKey1 point
-
This is happening when you minimize a window. A minimized window will be positioned at -32000 / -32000. You need to check the state of the window before you write to the ini file.1 point
-
have a look here:1 point
-
From me as well : "Thanks for sharing" That is true, but it makes a big difference whether the nut is made of gold or is rotten. Moreover, finding something is only the first step. There must also be someone willing to spend his time to prepare something delicious from it (as you did) .1 point
-
Thanks for sharing. Intriguing stuff that I just might use one day ... I see the possibilities. Of course, like many I suspect, I have shared data between programs using an INI file entry or a Registry entry, probably even via SQL. I've also done it using STDOUT and STDIN by compiling to a console based executable. Your project however seemingly promises more and better. Cheers1 point
-
I am no expert with AutoIt GUIs. Your scripts can probably be set up as individual functions within your script, each one triggered by a button on the main form. Probably best to wait for someone more experienced to help you with this. They will be along in a few hours - different time zone from me.1 point
-
In Scite just run the Koda Form Designer from the tools menu. From there you can create the outline for a simple GUI control. Click on the controls you may need and drop them on the design form. Try it, you may find it fairly intuitive, Search google for autoit koda form designer tutorial where you will find some Youtube tutorials.1 point
-
Hey, yes you can, see example for array & object (in array) below - I think problems only really occur with DLLStructs, Pointers and Function-References. Some types (like handles) have to be Hwnd()'ed again on the other side. As far as I understood, those are internal limitations. Larsj did a great job summarizing it here (scroll down to "data types"): $aArray : Array variable type. $dBinary : Binary variable type. $bBoolean : Bool variable type. $pPtr : Int32 variable type. $hWnd : Int32 variable type. $iInt : Int32 variable type. $fFloat : Double variable type. $oObject : Object variable type. $sString : String variable type. $tStruct : Not recognized as a valid variable type. $vKeyword : Keyword variable type. fuMsgBox : Not recognized as a valid variable type. $fuFunc : Not recognized as a valid variable type. $fuUserFunc : Not recognized as a valid variable type. Example SharedData4:1 point
-
How to retrieve Fontsize and Weight?
pixelsearch reacted to Yashied for a topic
Something like this? #Include <Array.au3> #Include <FontConstants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> GUICreate('MyGUI', 300, 200) $Label = GUICtrlCreateLabel('Simple Text', 20, 40, 100, 22) GUICtrlSetFont(-1, 12, 700, 2 + 4, 'Tahoma') GUISetState(@SW_SHOW) $aFont = GUICtrlGetFont($Label) _ArrayDisplay($aFont) Do Until GUIGetMsg() = -3 #cs [0] - Size [1] - Weight [2] - Attribute [3] - Name [4] - Quality #ce Func GUICtrlGetFont($CtrlID) Local $hWnd = GUICtrlGetHandle($CtrlID) If Not $hWnd Then Return 0 EndIf Local $Ret, $hDC, $hFont, $tFont Local $aFont = 0 $hDC = _WinAPI_GetDC($hWnd) $hFont = _SendMessage($hWnd, $WM_GETFONT) $tFont = DllStructCreate($tagLOGFONT) $Ret = DllCall('gdi32.dll', 'int', 'GetObjectW', 'ptr', $hFont, 'int', DllStructGetSize($tFont), 'ptr', DllStructGetPtr($tFont)) If (Not @error) And ($Ret[0]) Then Dim $aFont[5] = [0] $aFont[0] = -Round(DllStructGetData($tFont, 'Height') / _WinAPI_GetDeviceCaps($hDC, $LOGPIXELSY) * 72, 1) $aFont[1] = DllStructGetData($tFont, 'Weight') $aFont[2] = BitOR(2 * (DllStructGetData($tFont, 'Italic') <> 0), 4 * (DllStructGetData($tFont, 'Underline') <> 0), 8 * (DllStructGetData($tFont, 'Strikeout') <> 0)) $aFont[3] = DllStructGetData($tFont, 'FaceName') $aFont[4] = DllStructGetData($tFont, 'Quality') EndIf _WinAPI_ReleaseDC($hWnd, $hDC) Return $aFont EndFunc ;==>GUICtrlGetFont1 point -
and... maybe #include <GuiConstants.au3> _msgbox(1, "Please Press OK") _msgbox(2) _msgbox(3, "Would you like an Input-Box") Func _msgbox($xbox = 1, $mesg = "Please Respond") Global $Handle = GUICreate( "Main" , 200 , 100 ) Local $Button1, $Button2, $Button3, $CButton GUICtrlCreateLabel( $mesg, 10, 20, 180, 20, $SS_CENTER) If $xbox = 1 Then $Button1 = GUICtrlCreateButton( "OK only" , 50 , 50 , 100 , 25 ) If $xbox = 2 Then $Button2 = GUICtrlCreateButton( "Yes" , 10 , 50 , 80 , 25 ) If $xbox = 2 Then $CButton = GUICtrlCreateButton( "No" , 100 , 50 , 80 , 25 ) If $xbox = 3 Then $Button3 = GUICtrlCreateButton( "OK" , 10 , 50 , 80 , 25 ) If $xbox = 3 Then $CButton = GUICtrlCreateButton( "Cancel" , 100 , 50 , 80 , 25 ) GUISetState() While 1 $msg = GUIGetMsg(1) If $msg[1] = $Handle Then Select Case $msg[0] = -3 Exit Case $msg[0] = $Button1 ;_OKGUI() Return Case $msg[0] = $Button2 ;_YNGUI Return Case $msg[0] = $Button3 ;_IBGUI Return Case $msg[0] = $CButton Return EndSelect EndIf Sleep(10) ; If $msg[1] = $OKGUI such and such WEnd EndFunc ; GUI Functions... 8)1 point
-
divide numbers
Professor_Bernd reacted to FireFox for a topic
Anyway, this kind of question is unacceptable. There's a helpfile, and it takes 10secs.0 points