Leaderboard
Popular Content
Showing content with the highest reputation on 10/18/2018 in all areas
-
Help me build my AutoIT enviroment
Earthshine and one other reacted to iamtheky for a topic
welcome, grab Scite and start. Also, the GUI Builders are pretty weak. imho, the best GUI thread is this one, and you will learn far more manipulating these:2 points -
MailSlot
Professor_Bernd reacted to trancexx for a topic
This way of communication between processes very much resemble to the communication we do with our mail accounts. I would guess (smartly, no doubt) that was the key factor used for naming the functions when they were created. Information about mailslots can be found on microsoft's site, link. Summary could be that datagrams are used for communication and it's one-way and asynchronous. Attached zip file contains MailSlot.au3, AutoIt's implementation of these functions. Also there would be two scripts in there MailSlot_Sender.au3 and MailSlot_Reciever.au3. Both scripts are demos of the mailslot mechanism. Start both and use former to send mails to latter. Examples are basic and should show what's this about. MailSlot.zip Available functions are alphabetically: _MailSlotCheckForNextMessage_MailSlotClose_MailSlotCreate_MailSlotGetMessageCount_MailSlotGetTimeout_MailSlotSetTimeout_MailSlotRead_MailSlotWriteedit: New attachment. _MailSlotGetTimeout() function added to MailSlot.au3.1 point -
Title says enough (For those who don't know, scilexer is an editing control, like the one SciTE uses) It now supports multiple editors, and allows you to write your own lexer. Functions: Kip Old version (where AutoIt is the standard language) SciLexer.zip New version (which allows you to create your own lexer): _SciLexer.zip I recommend to use the new version Edit: AutoIt now isn't the standard language anymore1 point
-
I will check when I get home and get back to you on that.1 point
-
[SOLVED] - Help with Popup window on a IE automation
LearnbeforeyouBurn reacted to mLipok for a topic
https://docs.microsoft.com/pl-pl/windows/desktop/ipc/interprocess-communications http://www.drdobbs.com/windows/using-named-pipes-to-connect-a-gui-to-a/231903148 IPC UDF via FileMapping IPC IO Pool - Post Office for Organised Labour IPC with DLLStructure IPC by pboom InterProcess UDF - Runs a remote function! IPC via stdinwrite() and consoleread() Another Inter Script communication Container UDF - Scripts interaction library MailSlot EDIT: Do not think I'm so fast ... I've been preparing this list for the last hour. I just had other tasks and I did not have time to press "Submit Reply"1 point -
Show HDD's Free Space + Notfiy when Low
FrancescoDiMuro reacted to JLogan3o13 for a topic
This was unnecessary. Unless a suggestion from another forum member makes absolutely no sense for the OP's use (as some of yours have during your time here), which is not the case with user4157124's post, and there is no true performance benefit to doing it one way or another other than your personal preference, how about keeping your opinions to yourself?1 point -
Couldn't get it working either, however I just opened your 1.bmp with Paint and then saved it again as 1.bmp and it worked fine after that so something wrong with the original bmp.1 point
-
@mikell Because "(?<=X)", "(?=X), and "\b" are all assertions, I would says a look-around a look-around is more redundant than useless - merely semantics. In development, I went from, "(?<=/)(\d)(?=/)" to "(?<=^|/)(\d)(?=/|$)" to "(?<=\b)(\d)(?=\b)". I felt replete, and never considered the merest possibility of another step, "\b(\d)\b". Nice catch. Simplicity itself.1 point
-
StringSplit always returns an array, even if you use a blank line, see example below, personally I would just use the line count like in the example below or use Ubound as FrancescoDiMuro used. #include <Array.au3> Local $aArray, $aString[] = ["One,Two,Three", "", "Four,Five,Six,Seven,Eight","Nine,Ten"] For $i = 0 To UBound($aString) - 1 $aArray = StringSplit($aString[$i], ",") ;~ Check string has been split into three or more items If $aArray[0] >= 3 Then MsgBox(4096, "Success", "String has successfully been split into " & $aArray[0] & " line items.") Else MsgBox(16, "Failure", "String has been split into " & $aArray[0] & " line items.") EndIf _ArrayDisplay($aArray) Next1 point
-
Array variable has incorrect number of subscripts
Skeletor reacted to FrancescoDiMuro for a topic
@Skeletor If you allow me, IsArray() doesn't tell you if you have less elements in your array and/or you array has some blank elements. So, if you want to see if your array has less elements than the "normal", or has some blank elements, then you should do something like this: #include <Array.au3> Global $strIsArray = "Element1,Element2,ElementN", _ $strLessElements = "Element1,Element2", _ $strBlankElement = "Element1,,ElementN", _ $arrIsArray = StringSplit($strIsArray, ",", $STR_NOCOUNT), _ $arrLessElements = StringSplit($strLessElements, ",", $STR_NOCOUNT), _ $arrBlankElements = StringSplit($strBlankElement, ",", $STR_NOCOUNT), _ $varNotAnArray _ArrayDisplay($arrIsArray) _ArrayDisplay($arrLessElements) _ArrayDisplay($arrBlankElements) ; To detect if the array has less elements than normal, use UBound() If UBound($arrIsArray) < UBound($arrLessElements) Then ConsoleWrite("$arrLessElements has elements than $arrIsArray." & @CRLF) EndIf ; To detect if the array has a blank element For $i = 0 To UBound($arrBlankElements) - 1 Step 1 If $arrBlankElements[$i] = "" Then ConsoleWrite("Detected a blank element at the index '" & $i & "'." & @CRLF) Next ; As you can see from here, only $varNotAnArray, which is not an array, displays "False" as a result of IsArray() function ConsoleWrite("Is $arrIsArray an array? " & (IsArray($arrIsArray) ? "True" : "False") & @CRLF & _ ; True "Is $arrLessElements an array? " & (IsArray($arrLessElements) ? "True" : "False") & @CRLF & _ ; True "Is $arrBlankElements an array? " & (IsArray($arrBlankElements) ? "True" : "False") & @CRLF & _ ; True "Is $varNotAnArray an array? " & (IsArray($varNotAnArray) ? "True" : "False") & @CRLF) ; False1 point -
IPC IO
mLipok reacted to JohnWIlling for a topic
IPC_IO.AU3 I am in the need for a simple synchronous Client/Server communication. I found several examples and references to various kinds of Inter-Process Communications such as TCP, Named Pipes, Mail Slots, Shared Memory, Memory Mapped Files, and simple Files. I wanted to see what the best solutions would be. I began developing a library and slowly began adding each of the IPC methods and ended up with a library with a very simple synchronous “ASCII” API where the application can choose which method to use at startup. For the Server side, a Server app must initialize communication by calling: Func InitConnection($cType = $cDefaultType, $ResourceName = "", $bBlock = $cDefaultBlocking, $fSleepFunc = "", $iBufSize = $DEFAULT_BUFSIZE) The optional arguments allow the app to specify the connection type (such as: $cNamedPipe, $cFile, $cTCP, $cSharedMem, $cMailSlot), a value for the resource name (such as the file, named pipe name, TCP port number, etc.), the communication buffer size, and a callback function for when the “read” is waiting for data. A “File Descriptor” is returned and must be used in the future API calls. The Server side must then call: Func StartConnection($iFD) This call waits for a Client to connect. The Server then calls: Func ReadData($iFD, ByRef $sData) To read a Request from the Client and then calls: Func WriteData($iFD, ByRef $sData) To send the reply back to the Client. When communication with the Client is done, the Server app will call: Func StopConnection($iFD) When the Server app is done with the communications it will call: Func EndConnection($iFD) For the Client side, a Client app must open the communication by calling: Func OpenConnection($cType = $cDefaultType, $ResourceName = "", $bBlock = $cDefaultBlocking, $fSleepFunc = "", $iBufSize = $DEFAULT_BUFSIZE) The optional arguments allow the app to specify the connection type (such as: $cNamedPipe, $cFile, $cTCP, $cSharedMem, $cMailSlot), a value for the resource name (such as the file, named pipe name, TCP port number, etc.), the communication buffer size, and a callback function for when the “read” is waiting for data. A “File Descriptor” is returned and must be used in the future API calls. The Client side then send a request to the Server app by calling: Func WriteData($iFD, ByRef $sData) To read a Response from the Server by calling: Func ReadData($iFD, ByRef $sData) To end the connection to the Server by calling: Func CloseConnection($iFD) Within the IPC_IO.AU3 library, each IPC method is ether: · “stream” based where data is read/written by calling _WinAPI_ReadFile/TCPRecv or _WinAPI_WriteFile/ TCPSend · “direct” based for Shared memory where the Client reads the data directly from the Server App’s memory and the Server directly reads the Client App’s memory In processing a request, the “ReadData” process starts by checking if data is ready to be read by calling the routine: “ReadStart”, then it reads in the size of the request by calling “ReadSize”, it then reads in the Ascii Request by calling “ReadBuffer”, then the sequence is completed by calling “ReadEnd”. The Write Process follows the same sequence with “WriteData” calling “WriteStart”, “WriteSize”, “WriteBuffer”, “WriteEnd”. Results My testing showed that the performance of sending and receiving of a 10k file took: · "Shared Memory" was the fastest, at 0.007468 Sec · “Named Pipes” at 0.015954 · “Mail Slots” at 0.016427 · “File Based” at 0.270287 · “TCP” at 0.994884 IPC_IO.au3 Client.au3 Server.au31 point -
no its not, you said you cant use X with Y. When clearly you can, you just must specify the application. If accurate = misleading then yes, you did great, head pats all around.1 point
-
Hi! I wrote a small editor for another project that uses Scintilla with a custom lexer as editor component. Everything, including the lexer (styling and folding) is written in AutoIt in a way that it can be easily integrated into other projects. The archive contains everything neccessary: the compiled editor, complete source code, form definitions, external libraries, etc.. Certainly, everything written by someone else is documented, either in authors.txt in the "Libs" folder or as comments in the source itself. The lexer is mainly designed to be used with script languages (SGML-like languages won't work really well) and can be customized via its own menu item. You can add your own additional script language definitions as well. There are already some lexer definitions, test scripts and a small example, how to integrate the editor component into a different project (mainly only 4 lines of code) in the archive. See _LexingUDF_example.au3. When you start the editor it runs in german without any default lexer selected, so if you would like to start in english and with AutoIt lexing enabled, call it this way: 'scripteditor.exe -l=en -x=autoit' Apart from that you can go to 'Lexer' menu and choose one from the list. You can take a look at every command line parameter with '-h' Screenshot (ok, in german, yet I think you will understand): Download: ScriptEditor v1.9 A short description how to integrate the component into another project (for a closer look, see _LexingUDF_example.au3): ; 0.) we need the whole content of the archive, so extract everything, delete editor.au3 and start coding ;-) #include "_LexingUDF.au3" ; at first the parent GUI needs to be created, we need the control id (in this example $hGUI) ; 1.) now set the parent GUI for the new editor component $__default_editor_parent = $hGUI ; 2.) load a lexer definition - name of the file without .def extension from 'LexDef' folder _GUICtrlLex_ReadLEXFile($lexer) -> ie: _GUICtrlLex_ReadLEXFile("autoit") ; 3.) create editor component within $__default_editor_parent _GUICtrlLex_CreateScriptEditor($x, $y, $width, $height) -> ie: _GUICtrlLex_CreateScriptEditor(0, 0, 800, 600) ; 4.) initialize necessary variables, arrays, etc. and apply the styles, layout defaults, marker definitions, etc. which have been loaded before to the editor _GUICtrlLex_SetupStylingAndFolding() ; this is it.... for everyone who wants to have a nice menu with every existing lexer definition and a ; menu point to customize things, as shown in the screenshot, adds the following: ; (advice: use OnEvent mode to ease things) ; 5.) create a separate 'Lexer' main menu entry with everthing needed _GUICtrlLex_CreateLexerDefMenu('main') ; 6.) connect the menu item created in 5.) with the configuration dialog GUICtrlSetOnEvent($__arM[2], "_GUICtrlLex_OpenLexerDef") ; IMPORTANT: if you need to register your own WM_COMMAND or WM_NOTIFY routines, use ; _GUIRegisterMsg from _GUIRegisterMsg.au3 !!! Really nice is that you can change the lexer definition, colors, fonts, etc. and if you click on 'Save' everything will be applied immediately so that you can see what happens. Try it with the test scripts ;-) To be fair, I have to admit, that the editor is too slow for big scripts - it's running in AutoIt speed . But as speed wasn't important for me, because I wanted to handle small scripts with my own special lexing, it was ok for me. So please don't blame me for the fact, that your 8000 lines of code script won't get styled and folded really fast ;-) Also, there might be still some bugs in it and I don't really know how smart my way of coding is (especially the folding algorithm , perhaps a rewrite it from scratch), because I'm still quite new to AutoIt, but it was fun to do ;-) and it works for me. Perhaps someone likes it , it is meant as a contribution to a very informative forum ! Regards, Holger1 point
-
I'm glad I kept an archive of most of the things I found interesting! _LinkGrammar_au3.zip1 point
-
I believe there's something missing from this post.1 point
-
Thanks to Ascend4nt for the StringRegExp() syntax and the Authors of WinAPI.au3 for the "ExpandEnvironmentStringsW" API Function. Example use of Function: #include <Array.au3> #include <WinAPI.au3> #include <WinAPIShPath.au3> Local $sCmdLine = '%WINDIR%\PROGRAMNAME\settings.ini "C:\Users\Test\Desktop\PROGRAMNAME\PROGRAMNAME TESTING.au3" "C:\Users\Test\Desktop\PROGRAMNAME\PROGRAMNAME V1.0.au3" "C:\Users\Test\Desktop\PROGRAMNAME\Script Changes.txt"' Local $aArray = _CmdLineRaw($sCmdLine) _ArrayDisplay($aArray, '_CmdLineRaw()') $aArray = _WinAPI_CommandLineToArgv(_WinAPI_ExpandEnvironmentStrings($sCmdLine)) ; Using Win32 API calls. _ArrayDisplay($aArray, '_WinAPI_CommandLineToArgv()') ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CmdLineRaw ; Description ...: Creates an array of a $CmdLineRaw string or similar. ; Syntax ........: _CmdLineRaw($sString) ; Parameters ....: $sString - $CmdLineRaw-like string. ; Return values .: Success - An array, by default the first element ($aArray[0]) contains the number of strings returned, the remaining elements ($aArray[1], $aArray[n], etc.) contain the seperated strings. ; Failure - An array with the zeroth element set to 0. ; Author ........: guinness ; Modified ......: ; Remarks .......: Ascend4nt who designed the regular expression. ; Related .......: _StringParseParameters(): http://www.autoitscript.com/forum/topic/88995-stringparseparameters/ ; Example .......: No ; =============================================================================================================================== Func _CmdLineRaw($sString) Local $aReturn = StringRegExp('"' & @ScriptFullPath & '"' & ' ' & _WinAPI_ExpandEnvironmentStrings($sString), '((?<=\s"|^")[^"]+(?=")|[^\s"]+)', $STR_REGEXPARRAYGLOBALMATCH) $aReturn[0] = UBound($aReturn, 1) - 1 Return $aReturn EndFunc ;==>_CmdLineRaw1 point
-
it is just the example wich needs this include. Here is another one >_< _SciLexer.zip1 point
-
An example on how to create your own lexer and how to use callbacks: For more info check: http://www.scintilla.org/ScintillaDoc.html#Notifications #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinApi.au3> #include <_SciLexer.au3> Global $Statements = StringSplit("while wend do until for in step next if then else endif func endfunc or and"," ") $Gui = GUICreate("SciTest",800,700) $Sci = Sci_CreateEditor($Gui,200,10,590,680) Sci_StyleSet($Sci, $STYLE_DEFAULT, 0x000000, 0xFFFFFF, 0, 0, 0, "Courier New", 10) Sci_StyleClearAll($Sci); This might look weird, but it resets all styles to de default style. Sci_StyleSet($Sci, _ ; handle to control 1, _ ; The style number. This can be any number you like from 0 to 255, except not the numbers 32 to 39. 0xFF0000, _; Text color (BGR) 0xFFFFFF, _; Background color (BGR) false, _; Bold false, _; Italic false, _; Underline -1, _ ; Fontname -1, _ ; Fontsize false) ; Hotspot ; If any of the parameters is -1, then the value of the default style is used. GUIRegisterMsg(0x004E, "WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg(1) Switch $Msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Local $tagNMHDR = DllStructCreate("hwnd;int;uint;int;int;int;int;ptr;int;int;int;int;int;int;int;int;int;int;int", $lParam) Local $hWndFrom = DllStructGetData($tagNMHDR, 1) Local $IdFrom = DllStructGetData($tagNMHDR, 2) Local $Event = DllStructGetData($tagNMHDR, 3) Local $Position = DllStructGetData($tagNMHDR, 4) Local $Ch = DllStructGetData($tagNMHDR, 5) Local $Modifiers = DllStructGetData($tagNMHDR, 6) Local $ModificationType = DllStructGetData($tagNMHDR, 7) Local $Char = DllStructGetData($tagNMHDR, 8) Local $Length = DllStructGetData($tagNMHDR, 9) Local $LinesAdded = DllStructGetData($tagNMHDR, 10) Local $Message = DllStructGetData($tagNMHDR, 11) Local $uptr_t = DllStructGetData($tagNMHDR, 12) Local $sptr_t = DllStructGetData($tagNMHDR, 13) Local $Line = DllStructGetData($tagNMHDR, 14) Local $FoldLevelNow = DllStructGetData($tagNMHDR, 15) Local $FoldLevelPrev = DllStructGetData($tagNMHDR, 16) Local $Margin = DllStructGetData($tagNMHDR, 17) Local $ListType = DllStructGetData($tagNMHDR, 18) Local $X = DllStructGetData($tagNMHDR, 19) Local $Y = DllStructGetData($tagNMHDR, 20) Switch $Event Case $SCN_MODIFIED If BitAND($ModificationType, $SC_MOD_INSERTTEXT) or BitAND($ModificationType, $SC_MOD_DELETETEXT) Then Local $tChar = DllStructCreate("char["&$Length&"]",$Char) Local $Text = DllStructGetData($tChar, 1) ; $hWndFrom is $Sci $iLine = Sci_GetCurrentLine($hWndFrom) $iStartPos = Sci_GetLineStartPos($hWndFrom, $iLine-1) $sLine = Sci_GetLine($hWndFrom, $iLine-1) Sci_StyleApply($hWndFrom, $STYLE_DEFAULT, $iStartPos, StringLen($sLine)); Reset this line's style For $i = 1 to $Statements[0] $iOcc = 1 While 1 ; $Statements[$i] is the statement $iPos = StringInStr($sLine, $Statements[$i], 2, $iOcc) if $iPos = 0 Then ExitLoop Sci_StyleApply($hWndFrom, 1, $iStartPos+$iPos-1, StringLen($Statements[$i])) Sci_CalltipShow($hWndFrom, $iPos, $Statements[$i]) $iOcc += 1 WEnd Next EndIf Case $SCN_CHARADDED; Only when 1 char is added, so it isn't very usefull. Local $Text = Chr($Ch) Case $SCN_HOTSPOTCLICK Case $SCN_CALLTIPCLICK MsgBox(0,"Example","That's right!") EndSwitch Return $GUI_RUNDEFMSG EndFuncIf it starts complaining about a duplicate funtion name, remove the WM_NOTIFY function from _SciLexer.au3.1 point
-
@FrancescoDiMuro Loved that one.0 points