Leaderboard
Popular Content
Showing content with the highest reputation on 11/12/2020 in all areas
-
Ideas on how to create arrays easily?
markyrocks and one other reacted to Nine for a topic
Try this : #include <Constants.au3> #include <Array.au3> $_FilePath = '1.txt' $_FileRead = FileReadToArray ($_FilePath) ;_ArrayDisplay($_FileRead) $Txt = '"' & _ArrayToString($_FileRead,",") & '"' ClipPut($Txt) MsgBox($MB_SYSTEMMODAL, "", $Txt); may not need this but here just so I can quickly see what it's showing me2 points -
No output for simple array... worked a million times before.
markyrocks and one other reacted to pseakins for a topic
From the help. 1 - Error opening specified file The file is NOT being read. Therefore you get the array subscript error because the array does not get populated. Maybe you still have the file open in your editor or some other app, preventing the au3 script from accessing it.2 points -
Some notes on my examples: When you mark just one collumn in an Excel Spreadsheet and press CTRL+C, you will find in the clipboard all the values delimited by @CRLF. Instead of my lines $s1d= <string-definition> you could also use $s1D=ClipGet() Same is fact for the example for a 2D array: When you mark a range of cells in Excel and copy it to your clipboard, the values of one line are @TAB delimited, the lines are delimeted by @CRLF Same as above is fact for the $s2D string value: Instead of filling it manually with $s2D=<string-definition> you can use $s2D=ClipGet() ... just after you've copied the marked cell range in Excel to your clipboard.1 point
-
Help: How to detect Hardware Mouse Button? - (Locked)
BrAiNee reacted to JLogan3o13 for a topic
Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team1 point -
SSH and cmd send password
faustf reacted to JLogan3o13 for a topic
Well, spoon-feeding it to you is what you usually want. I guess you can hope someone comes along that is willing to do the work for you after 9 years on the forum....1 point -
Well, I don't know if it would work in your case but in general if you want to avoid a specific event from happening, you set a boolean type variable and switch it before and after actions that may trigger it.Then check against the boolean variable inside the function that gets called, and add an if statement, etc. This may work for you perhaps. Can't really say, as I am not sure the order of events. Instead of checking for boolean in the while condition perhaps add an if statement for it inside. Global $g_bBypass = False While _IsPressed("01") and $g_bBypass = False $g_bBypass = True MouseUp("left") $g_bBypass = False ;do stuff while pressing the real mouse button WEnd1 point
-
Hey again, Thanks for the "thanks" Since you didn't say if the macro helps you creating your data, can you use it? I just used my imagination for possible cases, of course that might not be the case. If you would like to use it, does it need any modifications? Anything you want to be added/changed? - Just noticed, you also have numbers, which may be formatted. Changing format of the Data sheet A column to text, and creating strData from range().text instead of range().value fixes that too. You get what you see this way. Uploading the modified xlsm. And it should be creating the array you want, if you add that one line of AutoIt code. Then do whatever with the array. Why add extra steps to put commas and strip them away later? or when double quotes are prepended/appended The test au3 is: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #AutoIt3Wrapper_Outfile=file_read_to_array_test.a3x #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> test() func test() Local $aTest = FileReadToArray(@DesktopDir & "\array_list.txt") _ArrayDisplay($aTest,"Test") EndFunc test.xlsm1 point
-
To simplify : #include <Constants.au3> #include <Array.au3> $_FilePath = '1.txt' $_FileRead = FileReadToArray ($_FilePath) ;_ArrayDisplay($_FileRead) $Txt = "Dim $array[" & UBound($_FileRead) & "] = [" & '"' & _ArrayToString($_FileRead,CHR(34)&","&CHR(34)) & '"]' ClipPut($Txt) MsgBox($MB_SYSTEMMODAL, "", $Txt); may not need this but here just so I can quickly see what it's showing me1 point
-
Ideas on how to create arrays easily?
markyrocks reacted to rudi for a topic
Hi. Simply read the file to the array directly? Pls. lookup in the help file: filereadtoarray() and _filereadtoarray()1 point -
Ideas on how to create arrays easily?
Atrax27 reacted to markyrocks for a topic
check out the library i'm writing its still in its prepubescent form but its covering a wide variety of ways to manipulate arrays. I'm getting ready to dump a huge update but it covers about everything you can imagine. that and it ridiculously simplifies creating and expanding arrays. It will take a few to get used to what it does. As it stands a few functions aren't working optimally or even as intended but they are very complex. my head is about to explode but i think its a real game changer. The mass majority are working will you just have to get used to the system. It is overwhelmingly huge but i have a bunch of test cases to play with. So playing around with those should get anyone started somewhat quickly. O and the Sort function in the currently posted version is horribly unoptimized so i'd suggest using the regular _array_sort() at least for the time being.1 point -
The simple answer is that we will never support screwing around with the generated tokenized sourcecode so is the answer "no". Get yourself a simple Github account or setup a local SVN library and perform some proper source versioning is the appropriate answer. Jos1 point
-
Hey Atrax, You can do all of that with VBA. I created an xlsm file for you. How to use: 1. Open both excel files (The one I am attaching (code at the bottom of post) and your data xlsx) 2. I added shortcuts to the couple of macros, you can change them with ALT+F8 > Select the macro > Options. - Copy with CurrentRegion method: CTRL + SHIFT + C - Copy with Range method: CTRL + SHIFT + R - Toggle "Got Headers" value: CTRL + SHIFT + T - Clean Data Sheet: CTRL + SHIFT + L CurrentRegion method: Say you have data like this, filtered and you want all of the rows visible. Row1 is header. So you toggle "Got Headers" to "Yes". - If you want only 1 column, select the header of that column and use ShortCut key combo (see above) to add the visible rows to xlsm file Data sheet. - For consecutive columns: If you want to concatenate B and C columns with a space in between, you select both headers (click hold and drag) - If you want B and C seperately, select B first and select C afterwards by holding CTRL. I guess you get the idea, for example this would work too: Select A, Select B & C, Select D. This would first copy rows of A, then copy B & C rows, and finally copy D rows Range method: If you just want a part of the list, use this method. The following selection would, for example, add to Data sheet the following. A2 A4 & B4 A10 & B10 & C10 & D10 A13 & B13 & C13 & D13 A17 & B17 & C17 & D17 B24 C30 & D30 B32 & C32 & D32 C34 C35 C36 When you are done, there is another macro that creates the file to be used by your AutoIt script. I tested with a3x compiled and it works. Also, starts that script. I haven't assigned any shortcuts to this. But as you already know, it is easy to assign/change a shortcut. There are a couple of options: All you need to do within your AutoIt script is add this line: #include <Array.au3> Local $aArray = FileReadToArray(@DesktopDir & "\array_list.txt") The code involved is as follows ( I used Sheet.CodeName's instead of Name, however they are the same) Option Explicit Option Compare Text Public Sub Copy_CurrentRegion() Dim rngData As Range Dim cCell As Range Dim ColumnCount As Integer Dim RegionCount As Integer Dim HeaderOffset As Integer Dim rngRow As Range Dim rowData As Long ' Find out first available line in Data sheet If Data.Range("A1").Value = "" Then rowData = 1 Else rowData = Data.Range("A1").CurrentRegion.Rows.Count + 1 End If ' Set HeaderOffset HeaderOffset = 0 If Settings.Range("Headers").Value = "yes" Then HeaderOffset = 1 ' Find out how many regions are selected RegionCount = Len(Selection.Address) - Len(Replace(Selection.Address, ",", "")) + 1 Dim i As Integer Dim j As Long Dim strData As String ' Cycle through all regions For i = 1 To RegionCount Set rngData = ActiveSheet.Range(Split(Selection.Address, ",")(i - 1)) ' Find how many columns are in the region ColumnCount = Len(rngData.Address) - Len(Replace(rngData.Address, ":", "")) + 1 If ColumnCount = 2 Then ColumnCount = Range(Split(rngData.Address, ":")(1)).Column - Range(Split(rngData.Address, ":")(0)).Column + 1 End If ' Set rngData to the current region's first column for un-filtered rows Set rngData = rngData.Offset(HeaderOffset, 0).Resize(rngData.CurrentRegion.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible) ' Cycle thorough all cells in rngData For Each cCell In rngData strData = "" For j = 1 To ColumnCount strData = strData & " " & Trim(cCell.Offset(0, j - 1).Value) Next j ' Write concatenated string to Data sheet If Settings.Range("DoubleQuotes").Value = "no" Then Data.Range("A" & rowData).Value = Trim(strData) Else Data.Range("A" & rowData).Value = Chr(34) & Trim(strData) & Chr(34) End If rowData = rowData + 1 Next cCell Next i ' Clean up Set rngRow = Nothing Set rngData = Nothing End Sub Public Sub Copy_Range() Dim rngData As Range Dim cCell As Range Dim ColumnCount As Integer Dim RegionCount As Integer Dim HeaderOffset As Integer Dim rngRow As Range Dim rowData As Long ' Find out first available line in Data sheet If Data.Range("A1").Value = "" Then rowData = 1 Else rowData = Data.Range("A1").CurrentRegion.Rows.Count + 1 End If ' Set Header Offset to 0 for Range Copy HeaderOffset = 0 ' Find out how many regions are selected RegionCount = Len(Selection.Address) - Len(Replace(Selection.Address, ",", "")) + 1 Dim i As Integer Dim j As Long Dim strData As String ' Cycle through all regions For i = 1 To RegionCount Set rngData = ActiveSheet.Range(Split(Selection.Address, ",")(i - 1)) ' Find how many columns are in the region ColumnCount = Len(rngData.Address) - Len(Replace(rngData.Address, ":", "")) + 1 If ColumnCount = 2 Then ColumnCount = Range(Split(rngData.Address, ":")(1)).Column - Range(Split(rngData.Address, ":")(0)).Column + 1 End If ' Set rngData to the first column in the current region Set rngData = rngData.Resize(rngData.Rows.Count, 1) ' Cycle through all cells in rngData For Each cCell In rngData ' Check if cell is filtered (RowHeight = 0) If Not ActiveSheet.Rows(cCell.Row).RowHeight = 0 Then strData = "" For j = 1 To ColumnCount strData = strData & " " & Trim(cCell.Offset(0, j - 1).Value) Next j ' Write concatenated string to Data sheet If Settings.Range("DoubleQuotes").Value = "no" Then Data.Range("A" & rowData).Value = Trim(strData) Else Data.Range("A" & rowData).Value = Chr(34) & Trim(strData) & Chr(34) End If rowData = rowData + 1 End If Next cCell Next i ' Clean up Set rngRow = Nothing Set rngData = Nothing End Sub Public Sub Toggle_Headers() ' Toggle Got Headers value If Settings.Range("Headers").Value = "Yes" Then Settings.Range("Headers").Value = "No" Else Settings.Range("Headers").Value = "Yes" End If End Sub Public Sub Clean_ArrayList_Data() ' Clean existing data on the Data sheet Data.Range("A1").CurrentRegion.ClearContents End Sub Public Sub Create_ArrayListFile() Dim FolderName As String Dim FileName As String ' Get Folder to save txt file If Settings.Range("ArrayList_Folder").Value = "Desktop" Then FolderName = Environ$("Userprofile") & "\Desktop" else FolderName = Settings.Range("ArrayList_Folder").Value endif FileName = Settings.Range("ArrayList_Filename").Value Dim fso As FileSystemObject Dim oFile As TextStream Set fso = New FileSystemObject ' Delete existing txt file if it exists If fso.FileExists(FolderName & "\" & FileName) Then fso.DeleteFile (FolderName & "\" & FileName) ' Create new txt file Set oFile = fso.CreateTextFile(FolderName & "\" & FileName, True) ' Write all lines in Data sheet to txt file Dim i As Long For i = 1 To Data.Range("A1").CurrentRegion.Rows.Count oFile.WriteLine (Data.Cells(i, 1).Value) Next i ' Close txt file oFile.Close ' Clean up Set oFile = Nothing Set fso = Nothing ' Call Sub to run the script Call Run_Script End Sub Private Sub Run_Script() ' Run script file Shell ("cmd.exe /c start """ & Settings.Range("AutoIt").Value & """ """ & Settings.Range("Script").Value & """") End Sub test.xlsm1 point
-
No output for simple array... worked a million times before.
markyrocks reacted to FrancescoDiMuro for a topic
@tommytx Try something like this: $mylist = @ScriptDir & "\doggone.txt" It seems that you are not reading the file.1 point -
So you can just create the file using _FileWriteFromArray for example: #include <Array.au3> #include <File.au3> ;~ Create dummy data Local $sListData = "Liam" & @CRLF $sListData &= "Olivia" & @CRLF $sListData &= "Noah" & @CRLF $sListData &= "Emma" & @CRLF $sListData &= "Oliver" & @CRLF $sListData &= "Ava" & @CRLF $sListData &= "William" & @CRLF $sListData &= "Sophia" & @CRLF $sListData &= "Elijah" & @CRLF $sListData &= "Isabella" & @CRLF $sListData &= "James" & @CRLF $sListData &= "Charlotte" & @CRLF $sListData &= "Benjamin" & @CRLF $sListData &= "Amelia" & @CRLF $sListData &= "Lucas" & @CRLF $sListData &= "Mia" & @CRLF $sListData &= "Mason" & @CRLF $sListData &= "Harper" & @CRLF $sListData &= "Ethan" & @CRLF $sListData &= "Evelyn" ;~ Create array Local $aListData = StringSplit($sListData, @CRLF, 1) ;~ File to save the array Local $sListFile = @ScriptDir & "\ListData.txt" ;~ Write the array to the file _FileWriteFromArray($sListFile, $aListData, 1) ;~ Display the ListData.txt file ShellExecute($sListFile)1 point
-
ADO_EXAMPLE_WinMacBear_Test2_XLS.au3 #AutoIt3Wrapper_UseX64=N #Tidy_Parameters=/sort_funcs /reel #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Array.au3> #include <AutoItConstants.au3> #include <Date.au3> #include <MsgBoxConstants.au3> #include "ADO.au3" ; SetUP ADO.au3 UDF COMError Handler _ADO_ComErrorHandler_UserFunction(_ADO_COMErrorHandler_Function) Global $oADOConnection = _ADO_Connection_Create() Global $oADORecordset = _ADO_Recordset_Create() Global $oADOConnection_EventsHandler = ObjEvent($oADOConnection, "_ADO_EventHandler_") #Region - Work in progress # This following line is commented out because it fires: AutoIt3.exe ended.rc:-1073741819 ;~ Global $oADORecordset_EventsHandler = ObjEvent($oADORecordset, "_ADO_EventHandler_") #EndRegion - Work in progress Global $sFilename = @ScriptDir & "\ADO_EXAMPLE_WinMacBear_TEST.xls" Global $sADOConnectionString = _ADO_ConnectionString_Excel($sFilename, 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0', 'Yes') checkExcelCell("testable", 10) Func checkExcelCell($querytable, $queryid) ; check - lets see what XLS contain _Example_2_RecordsetDisplay($sADOConnectionString, "Select * FROM [testable$]") Local $iResult = _ADO_Connection_OpenConString($oADOConnection, $sADOConnectionString) If @error Then Return SetError(@error, @extended, $iResult) Local $sADOSQL = "SELECT * FROM [" & $querytable & "$] WHERE ID =" & $queryid $oADORecordset.Open($sADOSQL, $oADOConnection, $ADO_adOpenDynamic, $ADO_adLockOptimistic) If __ADO_Recordset_IsNotEmpty($oADORecordset) Then With $oADORecordset While Not .EOF .Fields(3).Value = _NowCalc() .MoveNext WEnd EndWith Else MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONINFORMATION, 'Information', 'No record found') EndIf ; check again - XLS content _Example_2_RecordsetDisplay($sADOConnectionString, "Select * FROM [testable$]") _ADO_Connection_Close($oADORecordset) $oADORecordset = Null ; Release the recordset object _ADO_Connection_Close($oADOConnection) $oADOConnection = Null ; Release the connection object EndFunc ;==>checkExcelCell #Region - MISC Func _ADO_EventHandler_FieldChangeComplete($iFields, ByRef $aFields, ByRef $oError, $i_adStatus, ByRef $oRecordset) ;https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/willchangefield-and-fieldchangecomplete-events-ado?view=sql-server-ver15 #forceref $iFields, $aFields, $oError, $i_adStatus, $oRecordset ConsoleWrite('! ' & @ScriptLineNumber & @CRLF) EndFunc ;==>_ADO_EventHandler_FieldChangeComplete Func _ADO_EventHandler_WillChangeField($iFields, ByRef $aFields, $i_adStatus, ByRef $oRecordset) ;https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/willchangefield-and-fieldchangecomplete-events-ado?view=sql-server-ver15 #forceref $iFields, $aFields, $i_adStatus, $oRecordset ConsoleWrite('! ' & @ScriptLineNumber & @CRLF) EndFunc ;==>_ADO_EventHandler_WillChangeField Func _Example_2_RecordsetDisplay($sConnectionString, $sQUERY) ; Create connection object Local $oConnection = _ADO_Connection_Create() ; Open connection with $sConnectionString _ADO_Connection_OpenConString($oConnection, $sConnectionString) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE) ; Executing some query directly to Array of Arrays (instead to $oRecordset) Local $aRecordset = _ADO_Execute($oConnection, $sQUERY, True) ; Clean Up _ADO_Connection_Close($oConnection) $oConnection = Null ; Display Array Content with column names as headers _ADO_Recordset_Display($aRecordset, 'Recordset content') EndFunc ;==>_Example_2_RecordsetDisplay #EndRegion - MISC Testing files: WinMacBear_TestingFiles.ZIP1 point
-
Hello to all. My name is Daniel, I am original of the Argentina and 9 months ago about that development in Autoit, after having passed through other languages type Basic I found a model of development which adapts to my tastes and I am comfortable, but my performance to generate new applications was slow due to the lack of GUI Builder. I found a model of development which adapts to my tastes and I am comfortable, but my performance to build new applications was slow due to lack of a generator of GUI. This situation led me to find a project open-source which adapted to my needs. Review several of the programs appointed by TheSaint, opting to improve and complete 'GuiBuilder Resurrected' publish by baroquebob; when I did was not (or not view the GUIBuilderNxt update by jaberwacky). Below I dedicate some paragraph to this. Also probe (and I was surprised) with Koda , but they are not open-source. (the ISN Studio is super , but very complex for my) Well, here I leave you the link to download, I do so with the idea that you can use it, give me your opinion and help me improve it. Equally here leave you a list of characteristics, all the changes were designed and implemented in a way that respects the job before made by CyberSlug, Roy, TheSaint and Bob ; without radical changes continuing what they started. * New control 'Pick color' * New properties 'Backgroud Color' and 'Style' * New Functions Export file (.au3) and 'Test' * Other function not finalizated.Yet * Improve Documentation. Wait for your comments... Regards Daniel guibuilder_0.9.3.zip1 point
-
Hello to all.. Returning this project, submitted a new version of the GUIBUILDER. This is an open project and i hope your suggestion and collaboration. Sample of Look and Feel. 1) Motivations: When you return to the development of the guibuilder, i ask to myself because I make a new program when there are already other full already extensive use among programrs as for example ISNT Studio or the K.O.D.A. And I found myself with the necessity that this is easily extensible, independent of the programming language and in a future integrated into a larger suite that includes other components (e.g., automation in the program flows, modeling of data structure, programming by rules, distinction of tasks by users, integration with other applications using standards such as SOAP or REST, etc.). This is so understanding the state of the art of software development today, is no longer useful that the aid is only in GUI development's. 2) Rationalizations: My first impulse to resuming development was to follow the methodology applied up until that time. But to have to speak the message loop to add the editing of properties of the window, I found myself in a quagmire to locate the exact site where to insert the new code. Just at that moment I understood because in Guibuilder Ravamped withdrew all the code that did not belong to the basic structure. This experience led me to adopt a third alternative expressed in the following actions: Convert all pieces of possible codes in functions: to each of these new features, you added a description and document parameters of Estrada, output and global variables used or modified. Organization of code and functions in sections: I understood that it is easier to find, understand and modify a section of code, if this is grouped according to what it does, The separation into Sections also reached to code generated by the GuiBuilder. Use a Database: In reviewing the various codes to modify i found that many of them were very similar, being able to save labor and time, separating the data in the instructions themselves and placing the latter in a local database (see Modifying_db.txt and structure_db.txt) Edition of Properties: While many controls have similar properties, this is not the case for all of them. By this replaced the fields Edit, by a grid, then automated change of each one of them, placed in the Db information on editing mechanism, by default values and classes about which it applies. New main window: It seemed to me that the program should have a separate to the main window of the properties and is remade the menu by placing some of its functions in a toolbar 4) State of the art While the Guibuilder works and generates a correct code, there are many even the facilities that I would like to add to it a full form builder. The functions currently available are: Usable Controls: Button, Checkbox, Radio, Edit, Input, Label, List, combo, Date, TreeView (incomplete), Icon, Pic, Progress Bar, Slider Bar, Group (incomplete) y Choose Color (New). Properties availables: and dependent on the control class chosen, are: Name, Left, Top, Width, BKColor, Color, Image, Style, Tip, Text, State, Cursor, Font (Type, size, color, styles) , Caption, Height, Value Default, Nombre de Clase, Style_ex, Source. Windows Properties: (incomplete) Grid: Enabled / Disabled, automatic alignment, alignment of the current control or all controls. Menu features: with added, enabled, disabled fast (see Menu.txt) Toolbar features: with added, enabled, disabled fast (see Toolbar.txt) Properties: Quick Add (see properties.txt) Debug: In the execution of code compiled or interpreted in a separate window (Open Debugview.exe - included) Debugging Features: display of internal arrays of operation ($MCL[], $Type[], $Grippy[], $CursorInfo[]) Autoit code generation: using loop of messages Generation saved source: code at any time. Possibility to generate codes: in other programming languages In the header of Guibuilder.au3 are the incomplete list and the point’s detected errors not yet corrected. 5) To Next ?. There are many tasks that are still to be carried out, to get to the objective explained in paragraph motivations, even that this form creator is as useful as possible to the developer. I would like to start by modifying the following: Autoit code generation using events. Complete controls disabled Tab, Menu, Context Menu, file etc. Added child windows. Correction of known bugs. Import function of code: after the modifications to it, made by a programer. Complete mass Modification: (Maintenance menu in tools). Shrinking message loop and global variables: the ease of maintenance of the program is inversely proportional to this. Toolbar of Properties: converter of static (actual) to Dynamic. For easy add the new properties. Wanted Beta tester, developers and fresh ideas. Exampe of Independent Debug window. GuiBuilder v1.0.11.zip Regards Daniel1 point
-
Using Xpdf tools : ; #FUNCTION# ==================================================================================================================== ; Name...........: _XFDF_Info ; Description....: Retrives informations from a PDF file ; Syntax.........: _XFDF_Info ( "File" [, "Info"] ) ; Parameters.....: File - PDF File. ; Info - The information to retrieve ; Return values..: Success - If the Info parameter is not empty, returns the desired information for the specified Info parameter ; - If the Info parameter is empty, returns an array with all available informations ; Failure - 0, and sets @error to : ; 1 - PDF File not found ; 2 - Unable to find the external programm ; Remarks........: The array returned is two-dimensional and is made up as follows: ; $array[1][0] = Label of the first information (title, author, pages...) ; $array[1][1] = value of the first information ; ... ; =============================================================================================================================== Func _XFDF_Info($sPDFFile, $sInfo = "") Local $sXPDFInfo = @ScriptDir & "\pdfinfo.exe" If NOT FileExists($sPDFFile) Then Return SetError(1, 0, 0) If NOT FileExists($sXPDFInfo) Then Return SetError(2, 0, 0) Local $iPid = Run(@ComSpec & ' /c "' & $sXPDFInfo & ' "' & $sPDFFile & '"', @ScriptDir, @SW_HIDE, 2) Local $sResult While 1 $sResult &= StdoutRead($iPid) If @error Then ExitLoop WEnd Local $aInfos = StringRegExp($sResult, "(?m)^(.*?): +(.*)$", 3) If Mod( UBound($aInfos, 1), 2) = 1 Then Return SetError(3, 0, 0) Local $aResult [ UBound($aInfos, 1) / 2][2] For $i = 0 To UBound($aInfos) - 1 Step 2 If $sInfo <> "" AND $aInfos[$i] = $sInfo Then Return $aInfos[$i + 1] $aResult[$i / 2][0] = $aInfos[$i] $aResult[$i / 2][1] = $aInfos[$i + 1] Next If $sInfo <> "" Then Return "" Return $aResult EndFunc ; ---> _XFDF_Info ; #FUNCTION# ==================================================================================================================== ; Name...........: _XPDF_Search ; Description....: Retrives informations from a PDF file ; Syntax.........: _XFDF_Info ( "File" [, "String" [, Case = 0 [, Flag = 0 [, FirstPage = 1 [, LastPage = 0]]]]] ) ; Parameters.....: File - PDF File. ; String - String to search for ; Case - If set to 1, search is case sensitive (default is 0) ; Flag - A number to indicate how the function behaves. See below for details. The default is 0. ; FirstPage - First page to convert (default is 1) ; LastPage - Last page to convert (default is 0 = last page of the document) ; Return values..: Success - ; Flag = 0 - Returns 1 if the search string was found, or 0 if not ; Flag = 1 - Returns the number of occcurrences found in the whole PDF File ; Flag = 2 - Returns an array containing the number of occurrences found for each page ; (only pages containing the search string are returned) ; $array[0][0] - Number of matching pages ; $array[0][1] - Number of occcurrences found in the whole PDF File ; $array[n][0] - Page number ; $array[n][1] - Number of occcurrences found for the page ; Failure - 0, and sets @error to : ; 1 - PDF File not found ; 2 - Unable to find the external programm ; =============================================================================================================================== Func _XPDF_Search($sPDFFile, $sSearch, $iCase = 0, $iFlag = 0, $iStart = 1, $iEnd = 0) Local $sXPDFToText = @ScriptDir & "\pdftotext.exe" Local $sOptions = " -layout -f " & $iStart Local $iCount = 0, $aResult[1][2] = [[0, 0]], $aSearch, $sContent, $iPageOccCount If NOT FileExists($sPDFFile) Then Return SetError(1, 0, 0) If NOT FileExists($sXPDFToText) Then Return SetError(2, 0, 0) If $iEnd > 0 Then $sOptions &= " -l " & $iEnd Local $iPid = Run($sXPDFToText & $sOptions & ' "' & $sPDFFile & '" -', @ScriptDir, @SW_HIDE, 2) While 1 $sContent &= StdoutRead($iPid) If @error Then ExitLoop WEnd Local $aPages = StringSplit($sContent, chr(12) ) For $i = 1 To $aPages[0] $iPageOccCount = 0 While StringInStr($aPages[$i], $sSearch, $iCase, $iPageOccCount + 1) If $iFlag <> 1 AND $iFlag <> 2 Then $aResult[0][1] = 1 ExitLoop EndIf $iPageOccCount += 1 WEnd If $iPageOccCount Then Redim $aResult[ UBound($aResult, 1) + 1][2] $aResult[0][1] += $iPageOccCount $aResult[0][0] = UBound($aResult) - 1 $aResult[ UBound($aResult, 1) - 1 ][0] = $i + $iStart - 1 $aResult[ UBound($aResult, 1) - 1 ][1] = $iPageOccCount EndIf Next If $iFlag = 2 Then Return $aResult Return $aResult[0][1] EndFunc ; ---> _XPDF_Search ; #FUNCTION# ==================================================================================================================== ; Name...........: _XPDF_ToText ; Description....: Converts a PDF file to plain text. ; Syntax.........: _XPDF_ToText ( "PDFFile" , "TxtFile" [ , FirstPage [, LastPage [, Layout ]]] ) ; Parameters.....: PDFFile - PDF Input File. ; TxtFile - Plain text file to convert to ; FirstPage - First page to convert (default is 1) ; LastPage - Last page to convert (default is last page of the document) ; Layout - If true, maintains (as best as possible) the original physical layout of the text ; If false, the behavior is to 'undo' physical layout (columns, hyphenation, etc.) ; and output the text in reading order. ; Default is True ; Return values..: Success - 1 ; Failure - 0, and sets @error to : ; 1 - PDF File not found ; 2 - Unable to find the external program ; =============================================================================================================================== Func _XPDF_ToText($sPDFFile, $sTXTFile, $iFirstPage = 1, $iLastPage = 0, $bLayout = True) Local $sXPDFToText = @ScriptDir & "\pdftotext.exe" Local $sOptions If NOT FileExists($sPDFFile) Then Return SetError(1, 0, 0) If NOT FileExists($sXPDFToText) Then Return SetError(2, 0, 0) If $iFirstPage <> 1 Then $sOptions &= " -f " & $iFirstPage If $iLastPage <> 0 Then $sOptions &= " -l " & $iLastPage If $bLayout = True Then $sOptions &= " -layout" Local $iReturn = ShellExecuteWait ( $sXPDFToText , $sOptions & ' "' & $sPDFFile & '" "' & $sTXTFile & '"', @ScriptDir, "", @SW_HIDE) If $iReturn = 0 Then Return 1 Return 0 EndFunc ; ---> _XPDF_ToText1 point
-
So, this is my first UDF that I like to share with you all. It can be used to capture debug information written by programs using the OutputDebugString API. A lot of programs write useful information using OutputDebugString. I searched for a way to capture this information and came across this link. This describes a way to read debug information using C++. My first attempt was to try and rewrite this in pure AutoIt using DllCalls. But I guessed it was to much work, especially converting all the structures that are needed. So I decided to take a different approach and use a helper DLL. I used the code by Randy Charles Morin and rewritten it as a DLL. Additionally I made a wrapper UDF. I have put the DLL, UDF and a simple example of a viewer in this ZIP: DebugCapture.zip The DLL is written using Visual Studio 6. For those who are interested, I included the source: DebugCaptureDLLSource.zip The UDF contains 3 functions: _StartDebugCapture() This function loads the helper DLL and starts the capturing process. As soon as this function successfully returns, you have to call _GetDebugOutput() regularly to read the debug information. If you don't read the debug information, you will block the processes trying to write this information for a while (the OutputDebugString() API will block for a maximum time of 10 seconds). _StopDebugCapture() Call this function if you don't want to process debug information anymore. _GetDebugOutput() Call this on a regular basis, to read the debug information. The function is non blocking. If there is nothing to read it will just return an empty string. If you call this function with no parameters it will return all debug information. Optionally you can call it with a PID (for example returned by Run). That way you will only get the debug information written by that specific process. @extended is always set to the PID of the process that outputted the information. That's about it. Hope it's useful. Comments and suggestions are welcome! Steve1 point
-
yes its for a game, the problem is the game blocks different inputs, i fixxed this by using a second shoot key, but this will also stop the trigger, i try to catch the "real" mouse button then i will deactivate it and let the script do the shooting, so like a mouse proxy i dont know how to describe.... here my function. <snip>0 points