Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/14/2021 in all areas

  1. pixelsearch

    Array Column Delete

    Hi @jugador, interesting topic indeed. May I suggest another approach to avoid several calls to _ArrayColDelete (17 in your example + 17 Redim etc...) . In fact there is no call to _ArrayColDelete in the code below. There's probably a couple of error checking to add but you'll get the idea and It should go faster (the more columns to delete, the faster it should be). Please indicate if something goes wrong with this approach. ; Replace this : ;~ ;~ Sort a 1D Array ;~ _ArraySort($o_Column, 1) ;~ ;~ Delete Column ;~ For $i = 0 To UBound($o_Column) - 1 ;~ _ArrayColDelete($0_Array, $o_Column[$i]) ;~ Next ; With that : ; Sort a 1D Array of columns to delete (ascending, for $jStart and binary search to come) _ArraySort($o_Column) Local $jStart = $o_Column[0] ; 1st column to delete, i.e. don't touch column(s) on its left ConsoleWrite("$jStart = " & $jStart & @crlf) ; 1 in jugador's example _ArrayDisplay($o_Column, "To delete, asc") ; 17 cols ; Create a 1D array of columns to keep (ascending) Local $aColsToKeep[Ubound($0_Array, 2) - Ubound($o_Column)] ; 36 - 17 = 19 cols to keep ConsoleWrite("Ubound($aColsToKeep) = " & Ubound($aColsToKeep) & @crlf) ; 19 cols Local $iIndex = - 1 For $i = 0 To Ubound($0_Array, 2) - 1 If _ArrayBinarySearch($o_Column, $i) = -1 Then ; not found (-1) $iIndex += 1 ; 0+ $aColsToKeep[$iIndex] = $i EndIf Next _ArrayDisplay($aColsToKeep, "To keep, asc") ; 19 cols ; Position each element at its place, then 1 final Redim to delete rightmost column(s) For $i = 0 To Ubound($0_Array) - 1 For $j = $jStart To Ubound($aColsToKeep) - 1 $0_Array[$i][$j] = $0_Array[$i][$aColsToKeep[$j]] Next Next ReDim $0_Array[Ubound($0_Array)][Ubound($aColsToKeep)] ; 19 cols
    3 points
  2. If you have been using AutoIt for any length of time you will know that it is a great, and powerful scripting language. As with all powerful languages there comes a downside. Virus creation by those that are malicious. AutoIt has no virii installed on your system, and if a script you have created has been marked as a virus, (and you're not malicious) then this is a false positive. They found a set of instructions in an AutoIt EXE out there somewhere, took the general signature of the file, and now all AutoIt EXE's are marked (or most of them). This can be due to several reasons. AutoIt is packed with UPX. UPX is an open source software compression packer. It is used with many virii (to make them smaller). Malicious scripter got the AutoIt script engine recognized as a virus. And I am sure there are more ways your executable could be marked, but that covers the basics. Now I am sure you are wanting to know what you can do to get back up and running without being recognized as a virus. You have to send in a report to the offending AV company alerting them to the false positive they have made. It never hurts to send in your source code along with a compiled exe, to help them realize their mistake. You may have to wait up to 24 hours for them to release an update. The time it takes really depends on the offending AV company. Anti-Virus Links AntiVir Website Contact Avast! Website Contact McAfee Website Contact (email address) Symantec (Norton) Website Contact AVG Website Contact (It says sales or other ?'s I assume this will work) ClamWin Website Contact ClamAV Website Contact (I would only contact the ones with "virusdb maintainer or virus submission management") BitDefender Website Contact ZoneLabs Website Contact Norman Website Contact (email address) eSafe Website Contact (login required) A2 (A-Squared) Website Contact (email address) Edit: Added Website links and Contact links. I hope this helps you understand why your AutoIt executables are marked as virii. JS
    1 point
  3. Jon

    AutoIt v3.3.15.4 Beta

    AutoIt v3.3.15.4 Beta View File AutoIt: - Changed: PCRE regular expression engine updated to 8.44. - Added: doc pages about ControlID/Handle and String/Encoding. - Added #2375: SetError(), SetExtended() doc precision. - Added #3780: WinSetTitle() on notepad.exe is reverted when the windows get focus starting Windows 19H1 !!! - Added #3222: Doc precision for statement with 2 FileInstall(). - Added: ConsoleWrite() preserves the @error and @extended. - Added: ConsoleWriteError() preserves the @error and @extended. - Added #2938: Add "GetCount" to ControlCommand() - Added #3539: FileGetTime() UTC. - Added #3808: ProgressOn()/ProgressSet() - size of the progress window - Fixed: Missing Opt("SetExitCode", 1) and AutoIt3 Exit codes in doc. - Fixed #3211: Doc precision for hwnd parameter in Pixel*() functions. - Fixed #3774: Doc precision about Null keyword comparison. - Fixed #3579: DllStructGetData() doc precision. - Fixed #3823: Language Reference - Variables typo. - Fixed #3021: bad obj calling. - Fixed #3106: StringIsFloat() doesn't accept a valid FP exponent. - Fixed #3135: StdioClose memory leak. - Fixed #3165: Call UBound Array[0] AutoIt Crash. - Fixed #3167: Com error handler not called. - Fixed #3179: Number() failure with lower case hex. - Fixed #3182: MouseMove() on multiple screens. - Fixed #3232: Issue when parsing scientific notation literals. - Fixed #3659: InetClose() always false. - Fixed #3682: GuiCtrlCreatePic() with h=0 and w=0. - Fixed #3701: Crash with array 2^24. - Fixed #3710: @OSVersion for Server 2019. - Fixed #3743: [LAST] and WinWaitClose(), WinExists(), WinGetHandle(), etc. - Fixed #3772: int64 = -9223372036854775808 not handled properly. - Fixed #3778: ToolTip() position. - Fixed #3789: FileRead() on big ANSI file (1Gb). - Fixed #3790: UCS2 compare empty string. - Fixed #3807: GUISetIcon() in taskbar. - Fixed #3809: WinGetTitle() on windows created with _WinAPI_CreateWindowEx(). - Fixed #3817: Double to Int64 conversion. AutoItX: - Fixed: run*() showflag default SW_SHOWNORMAL. Aut2Exe: - Fixed #2383: Aut2exe GUI dropped files. - Added #3684: Aut2exe title with version. Au3Check: - Fixed #3785: Crash if too many includes. Au3info: - Added #3938: DPI scaling Support. UDFs: - Changed: Updated used Excel constant enumerations in ExcelConstants.au3 to Excel 2016. - Added #3514: _GUICtrlTreeView_GetLastItem() (Thanks Crazzy). - Added #3611: _GUICtrlListView_SetBkHBITMAP() (Thanks Alofa). - Added #3695: _SQLite_Display2DResult() 2 additional parameters $sDelim_Col and $sDelim_Row. - Added #3675: WinNET.au3 $tagNETRESOURCE: Add constants. - Added #3740: _ChooseColor() support Custom colors (Thanks argumentum). - Added #3547: _FormatAutoItExitCode() and _FormatAutoItExitMethod(). - Added #3696: _ArrayFromString(). - Added #3771: ColorConstants.au3 now include all W3C extended colors. THIS IS A small SCRIPT BREAKING CHANGE - Added #3739: _Array2DCreate(). - Added #3550: _Date_Time_SystemTimeToDateTimeStr() support 2 new formats to return GMT or ISO8601 format. - Added: _WinAPI_CreateProcess() example. - Added #3804: _GUICtrlMenu_CreateMenu() example to demonstrate menuclick non blocking. - Added #3806: _GDIPlus_GraphicsDrawString() with AlphaColor font. - Added #3811: _SQLite_Startup() new parameter to allow return AutoIt Type variables by _SQLite_FetchData(). - Added: _GUICtrlListView_GetSelectedIndices() optimisation (Thanks pixelsearch). - Added: _WinAPI_GetProcessName() and _WinAPI_GetParentProcessName() doc example (Thanks argumentum). - Added #3813: _MemGlobalRealloc(). - Added #3816: _WinAPI_ReadDirectoryChanges() example with magic number. - Fixed #3819: _FileCountLines() can use file handle. - Added: SpeedUp display and sorting of ArrayDisplay() and _DebugArrayDisplay() (Thanks LarsJ). - Fixed #3647: _GDIPlus_ImageResize() ghost border. - Fixed #3650: _GDIPlus_ImageResize() off by one. - Fixed #3633: _GUICtrlRichEdit_GotoCharPos() does not detect end of text. - Fixed #3765: _FileWriteLog() using Handle Cannot insert atvthe beginning, just set @extended. - Fixed #3776: __EventLog_DecodeDesc(). - Fixed: _GUICtrlListView_SetItemChecked() regression and more GUIListview.au3 functions. - Fixed: _WinAPI_CreateEvent() return error on already define $sName. - Fixed: use "wstr" for "ptr" with Null value. - Fixed #3791: _ArrayDisplay() sort arrow. - Fixed #3805: $tagRID_DEVICE_INFO_KEYBOARD definition. - Fixed #3810: _ArrayUnique not handling "Default" for Parameter $iIntType. - Fixed: _WinAPI_DragQueryFileEx() $iflag behavior when mix drag (Thanks pixelsearch). - Fixed #3812: _DateTimeSplit() returning @error. - Fixed #3814: $PAGE_ connstants for _WinAPI_CreateFileMapping(). - Fixed #3821: _WinAPI_OemToChar() with string greater than 65536 crash. - Fixed: _Now(), _NowCalc(), ... date time coherency when call just on hour change. (Thanks argumentum). - Fixed #3824: _GUICtrlRichEdit_StreamToFile(), _GUICtrlRichEdit_StreamFromFile() default encoding doc. - Fixed #3825: beta regression for $tagEDITSTREAM in x64. Submitter Jon Submitted 06/12/2021 Category Beta  
    1 point
  4. jugador

    Array Column Delete

    May not be useful for others but I do it this way when needed to delete lots of column. #include <Array.au3> #include "ArrayDeleteCol.au3" Local $x_Array[][] = [[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]] _ArrayDisplay($x_Array) Local $x_ColumnToDelete = '1;28;6-9;13;13;15;18-24;4;30' __Array_DeleteColumn($x_Array, $x_ColumnToDelete) _ArrayDisplay($x_Array) @pixelsearch version ArrayDeleteCol.au3 for __Array_DeleteColumn (Version 3) https://www.autoitscript.com/forum/topic/206244-array-column-delete/?do=findComment&comment=1487010
    1 point
  5. First one is easy --> false (because $a will be converted to 0) Second one : Not has highest precedence, so Not $a should return False, so False = 1 --> False Third one is easy if I am right on second --> True ps. my guess on second was right, but I wasn't really sure about it : gj Jocko pss. just googled translation on jocko : it means gaming. You are wearing your name very well !
    1 point
  6. TheXman

    Using SOAP to access data

    There are numerous examples in this forum on making HTTP POST requests. There's nothing special about doing a SOAP POST request other than making sure the Content-Type header is set correctly and the POST request data is correct.
    1 point
  7. Like @Subz already pointed out, it is not a good idea to voluntary compare String and Number.
    1 point
  8. The following works for me: #include <GUIConstantsEx.au3> #include <GuiTab.au3> Example() Func Example() GUICreate("Tab Example", 300, 160) GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) Local $idTab = GUICtrlCreateTab(10, 10, 280, 110) GUICtrlCreateTabItem("Tab 0") GUICtrlCreateTabItem("Tab 1") GUICtrlCreateTabItem("Tab 2") GUICtrlCreateTabItem("") Local $idLabel = GUICtrlCreateInput("", 10, 130, 50, 20) Local $idOK = GUICtrlCreateButton("OK", 65, 130, 50, 20) GUISetState(@SW_SHOW) Local $idMsg While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop Switch $idMsg Case $idOK Switch GUICtrlRead($idLabel) Case 0 To 15 _GUICtrlTab_SetCurFocus($idTab, 0) Case 16 To 30 _GUICtrlTab_SetCurFocus($idTab, 1) Case 31 To 50 _GUICtrlTab_SetCurFocus($idTab, 2) Case Else _GUICtrlTab_SetCurFocus($idTab, 0) EndSwitch EndSwitch WEnd EndFunc
    1 point
  9. @argumentum BTW : not a solution, just a typo : [...] Any_C(0) ; never Func Any_C($val = $default) If Not($val = $default) Then $var_B = $val EndFunc [...] If Not($val = $default) Then $var_C = $val -->not : If Not($val = $default) Then $var_B = $val EDIT : Sorry, I had overlooked @RTFC 's post. There he already noted that typo .
    1 point
  10. $var_B should be $var_C here, no?
    1 point
  11. I suggest to use Keyword "Default" to denote a default value not to assign values to Global variables in a function Could you please post a real life example so we can see what you try to achieve?
    1 point
  12. The issue is probably occurring because multiple expressions are returning true. You can check this with error checking in your code. Have you tried using Switch instead for example: Switch $lable Case $tar[0] To $top[0] Guictrlsetstate($tab2, $gui_show) Case $tar[1] To $top[1] ... EndSwitch
    1 point
  13. Think the issue is you're comparing a string and a number.
    1 point
  14. Jon

    AutoIt v3.3.15.4 Beta

    Implemented some of the fixes that JP has coded (thanks) and lots of changes the MVPs done on the libs.
    1 point
  15. 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_ToText
    1 point
×
×
  • Create New...