Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/06/2013 in all areas

  1. This is the HD link to the new video. It covers arrays, explaining them in comparison to Variables. I also cover their use with a For loop also a new For loop that arrays can use. I show a demonstration of pulling source code apart from a youtube playlist web page to get an array containing all the video titles by breaking the page source into chunks and getting closer until you can get the exact data you want. Hopefully it should demonstrate that arrays are very useful and help people to get a grasp on what they are all about. The Youtube playlist has been updated to include the new video. Link here:
    3 points
  2. Thanks, but this post is old and outdated. Please refrain from digging up old posts in the future.
    2 points
  3. MySQL UDFs using libmysql.dll functions: most functions from MySQL API all are prefixed with an underscore: _MySql... e.g.: _MySQL_Real_Query( sometimes parameters are chaged - read function descriptions in include file MySQL.au3 If you do not need the power of these UDFs and you simple want to use basic SQL commands, then have a look at not included: MySQL_Connect - This function is deprecated. Use _MySQL_Real_Connect instead. MySQL_Create_DB - This function is deprecated. Use mysql_query() to issue an SQL CREATE DATABASE statement instead. MySQL_Drop_DB - This function is deprecated. Use mysql_query() to issue an SQL DROP DATABASE statement instead. MySQL_Escape_String - You should use _mysql_real_escape_string() instead! MySQL_Kill - This function is deprecated. Use mysql_real_query() to issue an SQL KILL statement instead mysql_library_end - Called by _MySQL_EndLibrary. mysql_library_init - Called by _MySQL_InitLibrary. I included a fallback-libmysql.dll: yoou can include libMySQLDLL.au3 and set $Use_EmbeddedDLL=True when calling _MySQL_InitLibrary an example for XAMPP / cdcol is also included in ZIP. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.1 (beta) Author: Prog@ndy Script Function: MySQL-Plugin Demo Script #ce ---------------------------------------------------------------------------- #include <array.au3> #include "mysql.au3" ; MYSQL starten, DLL im PATH (enthält auch @ScriptDir), sont Pfad zur DLL angeben. DLL muss libmysql.dll heißen. _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "could nit init MySQL") MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() ;Fehler Demo: MsgBox(0,"Error-demo","Error-Demo") $connected = _MySQL_Real_Connect($MysqlConn,"localhostdfdf","droot","","cdcol") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif ; XAMPP cdcol MsgBox(0, "XAMPP-Cdcol-demo", "XAMPP-Cdcol-demo") $connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "", "cdcol") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM cds" $mysql_bool = _MySQL_Real_Query($MysqlConn, $query) If $mysql_bool = $MYSQL_SUCCESS Then MsgBox(0, '', "Query OK") Else $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) EndIf $res = _MySQL_Store_Result($MysqlConn) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) MsgBox(0, "", $rows & "-" & $fields) ; Access2 1 MsgBox(0, '', "Access method 1- manual") Dim $array[$rows][$fields] For $k = 1 To $rows $mysqlrow = _MySQL_Fetch_Row($res,$fields) $lenthsStruct = _MySQL_Fetch_Lengths($res) For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) $array[$k - 1][$i - 1] = $data Next Next _ArrayDisplay($array) ; Access 2 MsgBox(0, '', "Access method 2 - row for row") _MySQL_Data_Seek($res, 0) ; just reset the pointer to the beginning of the result set Do $row1 = _MySQL_Fetch_Row_StringArray($res) If @error Then ExitLoop _ArrayDisplay($row1) Until @error ; Access 3 MsgBox(0, '', "Access method 3 - read whole result in 2D-Array") $array = _MySQL_Fetch_Result_StringArray($res) _ArrayDisplay($array) ; fieldinfomation MsgBox(0, '', "Access fieldinformation") Dim $arFields[$fields][3] For $i = 0 To $fields - 1 $field = _MySQL_Fetch_Field_Direct($res, $i) $arFields[$i][0] = _MySQL_Field_ReadValue($field, "name") $arFields[$i][1] = _MySQL_Field_ReadValue($field, "table") $arFields[$i][2] = _MySQL_Field_ReadValue($field, "db") Next _ArrayDisplay($arFields) ; free result _MySQL_Free_Result($res) ; Close connection _MySQL_Close($MysqlConn) ; exit MYSQL _MySQL_EndLibrary() MySQL UDf Downloads: (including x86 and x64)</array.au3>
    1 point
  4. Jon

    AutoIt v3.3.9.20 Beta

    File Name: AutoIt v3.3.9.20 Beta File Submitter: Jon File Submitted: 06 Sep 2013 File Category: Beta 3.3.9.20 (6th September, 2013) (Beta) AutoIt: - Fixed #2405: Documentation bug for FileGetVersion() and compiled scripts. - Fixed #2314: Cursor flickers when moving over certain GUI controls. UDFs: AutoItX: - Added: AutoItX3.Assembly.dll - a .NET Assembly wrapper for the DLL. - Added: AutoItX3.PowerShell.dll and AutoItX3.psd1 - a set of PowerShell CmdLets. - Added: DLL Import: AU3_WinGetPos. - Added: DLL Import: AU3_ControlGetPos. - Added: DLL Import: AU3_MouseGetPos. - Added: DLL Import: AU3_WinGetClientSize. - Added: DLL Import: AU3_WinGetCaretPos. - Removed: DLL Imports: AU3_WinGetPosX, AU3_WinGetPosY, AU3_WinGetPosWidth, AU3_WinGetPosHeight. - Removed: DLL Imports: AU3_ControlGetPosX, AU3_ControlGetPosY, AU3_ControlGetPosWidth, AU3_ControlGetPosHeight. - Removed: DLL Imports: AU3_MousePosX, AU3_MouseGetPosY - Removed: DLL Imports: AU3_WinGetClientSizeWidth, AU3_WinGetClientSizeHeight. - Removed: DLL Imports: AU3_WinGetCaretPosX, AU3_WinGetCaretPosY. - Removed: DLL Imports: AU3_CDTray, AU3_BlockInput. - Removed: COM Methods: CDTray, BlockInput. - Removed: All registry functions. The support was limited and the host language will certainly have registry functions. - Removed: All Ini file functions. As per registry functions. Click here to download this file
    1 point
  5. Sure, #include <WindowsConstants.au3> #include <GUIConstants.au3> $hGUI = GUICreate('test', 400, 400, Default, Default, Default, $WS_EX_TOPMOST) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ;This line is here so that if other on top windows like the taskbar or task manager go over our window, we take the top back WinSetOnTop($hGUI, '', 1) WEnd
    1 point
  6. Wow, this is some fantastic work, fellas. Thanks for coming together and helping me solve this problem. This has GREATLY reduced the amount of time it takes to remove/exclude duplicates from my arrays. I have all I need to move forward at this point. Additionally, thanks to you Czardas for spending as much time on this as you did . This community is great!
    1 point
  7. I once made a UDF :-) Edit: added example #include "TGA AutoIt.au3" Global $tTGA = DllStructCreate($tagTGA) Global $hBitmap_TGA = _loadTarga($tTGA, @ScriptDir & "\0.tga") If @error Then ConsoleWrite("UDF error: " & @error & @CRLF) Exit EndIf Global $hGui = GUICreate("TGA example") Global $nPic = GUICtrlCreatePic("", 10, 10, 100, 100, 0x1000) _GDIPlus_Startup() Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap_TGA) Global $iX = _GDIPlus_ImageGetWidth($hImage) Global $iY = _GDIPlus_ImageGetHeight($hImage) Global $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB) Global $hImageNew = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClone) _WinAPI_DeleteObject(GUICtrlSendMsg($nPic, 370, 0, $hImageNew)) _WinAPI_DeleteObject($hImageNew) _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _freeTarga($tTGA) _GDIPlus_Shutdown() GUISetState() ; Save targa image to bitmap file ;~ _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\TGA_AutoIt.bmp") ; Save targa image to jpg file ;~ _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\TGA_AutoIt.jpg") Do Until GUIGetMsg() = -3
    1 point
  8. It's not really needed in this instance. Would you put brackets around 1 + 2? In this example 2 * 3 + 1 maybe, depends on where though as the answer can be 7 or 8.
    1 point
  9. Cravin, Another alternative. Comments and run times are in the code... #include <array.au3> #include "RecFileListToArray.au3" global $DataTabTargetNameInput = 'C:' global $DataTabUserNameInput = 'ADMIN010' global $tDups = 0, $aFinal[1], $tUniqueFiles = 0, $ttFiles = 0 ; The following file lists were setup to mimic your code using my PC ; ; The Results for processing these arrays was ; ; Total Files = 04880 Total Unique Files = 01659 Total Dups = 03221 ; Total time to process 004880 files = 0.1598 seconds ; ; This did not adequately stress the code so I also run the 4 directories at the bottom. $a02 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\Desktop", "*|desktop.ini", 1, 1, 0, 2) $a04 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\Windows\Templates", "*|desktop.ini", 1, 1, 0, 2) $a06 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Local\Microsoft\Outlook", "*|desktop.ini;*.obi;*.ost;*.kfl;*.pst", 1, 1, 0, 2) $a08 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput, "*|ntuser.dat;desktop.ini;*.dat.log1;*.dat.log2;*.blf;*.regtrans-ms;ntuser.ini;ntuser.pol|.thumbnails;AppData;Application Data;Cookies;Local Settings;NetHood;PrintHood;Searches", 1, 1, 0, 2) $a10 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\Systemcertificates", "*|desktop.ini", 1, 1, 0, 2) $a12 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\signatures", "*|desktop.ini", 1, 1, 0, 2) $a14 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\Favorites", "*|desktop.ini", 1, 1, 0, 2) $a16 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Local\Microsoft\Outlook", "*.pst|desktop.ini", 1, 1, 0, 2) $a17 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\Documents\Outlook Files", "*.pst|desktop.ini", 1, 1, 0, 2) $a20 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\Windows\SendTo", "*|desktop.ini", 1, 1, 0, 2) $a38 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput, "*|ntuser.dat;desktop.ini;*.dat.log1;*.dat.log2;*.blf;*.regtrans-ms;ntuser.ini;ntuser.pol|.thumbnails;AppData;Application Data;Cookies;Local Settings;NetHood;PrintHood;Searches", 1, 1, 0, 2) $a31 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\Systemcertificates", "*|desktop.ini", 1, 1, 0, 2) $a32 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\signatures", "*|desktop.ini", 1, 1, 0, 2) $a34 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\Favorites", "*|desktop.ini", 1, 1, 0, 2) $a36 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Local\Microsoft\Outlook", "*.pst|desktop.ini", 1, 1, 0, 2) $a37 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\Documents\Outlook Files", "*.pst|desktop.ini", 1, 1, 0, 2) $a30 = _RecFileListToArray("" & $DataTabTargetNameInput & "" & "\Users\" & $DataTabUserNameInput & "\AppData\Roaming\Microsoft\Windows\SendTo", "*|desktop.ini", 1, 1, 0, 2) ; ; The Results for processing the following 4 directories ; ; Total Files = 60444 Total Unique Files = 45910 Total Dups = 14534 ; Total time to process 060444 files = 1.7127 seconds ;~ $a40 = _RecFileListToArray("k:\sd\sd0100\mlb\boxes","*",1, 1, 0, 2) ;~ $a41 = _RecFileListToArray("k:\sd\sd0100\ncb\boxes","*",1, 1, 0, 2) ;~ $a42 = _RecFileListToArray("k:\sd\sd0100\nba\boxes","*",1, 1, 0, 2) ;~ $a43 = _RecFileListToArray("k:\sd\sd0100\mlb\boxes","*",1, 1, 0, 2) local $st = timerinit(), $sta = timerinit() for $1 = 0 to 50 if isarray(eval( 'a' & stringformat('%02s',$1) ) ) then _process_array( eval( 'a' & stringformat('%02s',$1) )) next ConsoleWrite(stringformat('Total Files = %05i Total Unique Files = %05i Total Dups = %05i',$ttFiles, $tUniqueFiles, $tDups) & @LF) redim $aFinal[$tUniqueFiles] ConsoleWrite(stringformat('Total time to process %06i files = %2.4f seconds',$tDups+$tUniqueFiles,timerdiff($st)/1000) & @LF) _arraydisplay($aFinal) func _process_array($array) local static $aFinal_idx = 0 local $tname, $tFiles = $array[0] $ttFiles += $array[0] redim $aFinal[ ubound($aFinal) + $tFiles ] for $1 = 1 to ubound($array) - 1 $tname = stringregexpreplace($array[$1],'[\.\:\\ ]','_') if isdeclared( eval('s' & $tname) ) = 0 then assign('s' & $tname,1,2) $aFinal[$aFinal_idx] = $array[$1] $aFinal_idx += 1 $tUniqueFiles += 1 Else $tDups += 1 endif next endfunc kylomas
    1 point
  10. #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> $IS_GUI = GUICreate("Problem example", 412, 366, 192, 124) Global $LISTVIEW = GUICtrlCreateListView("", 8, 8, 394, 350) Global $EX_STYLES = BitOR($LVS_EX_DOUBLEBUFFER, $WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) _GUICtrlListView_SetExtendedListViewStyle($LISTVIEW, $EX_STYLES) GUISetState(@SW_SHOW) Global $CION_SIZE_1 = 16, $CION_SIZE_2 = 32 Global $BIG_ICONS_1 = False, $BIG_ICONS_2 = True Global $DLL_1 = "example_1.dll", $DLL_2 = "example_2.dll" ;~ Seocnd image list $ICON_LV_ITEMS = _GUIImageList_Create($CION_SIZE_2, $CION_SIZE_2, 5, 3, 2) _GUIImageList_AddIcon($ICON_LV_ITEMS, $DLL_2, 0, $CION_SIZE_2) ; 0 , Tried 3 with no change and no icon _GUIImageList_AddIcon($ICON_LV_ITEMS, $DLL_2, 1, $CION_SIZE_2) ; 1 , Tried 4 with no change and no icon _GUICtrlListView_SetImageList($LISTVIEW, $ICON_LV_ITEMS, 1) ;~ First image list $ICON_LV_HEADER = _GUIImageList_Create($CION_SIZE_1, $CION_SIZE_1, 5, 3, 3) _GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 0, $CION_SIZE_1) ; 0 _GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 1, $CION_SIZE_1) ; 1 _GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 2, $CION_SIZE_1) ; 2 $HEADER = _GUICtrlListView_GetHeader($LISTVIEW) _GUICtrlHeader_SetImageList($HEADER, $ICON_LV_HEADER) ; Add Colums $NC_0 = _GUICtrlListView_InsertColumn($LISTVIEW, 0, "1", 100, 2, 0) $NC_1 = _GUICtrlListView_InsertColumn($LISTVIEW, 1, "2", 100, 2, 1) $NC_2 = _GUICtrlListView_InsertColumn($LISTVIEW, 2, "3", 100, 2, 2) ; Add Itmes $First = "ITEM" $2nd = "subitem 1 " $3rd = "subitem 2 " GUICtrlCreateListViewItem($First, $LISTVIEW) _GUICtrlListView_SetItem($LISTVIEW, $2nd, 0, 1, 0) _GUICtrlListView_SetItem($LISTVIEW, $3rd, 0, 2, 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
    1 point
  11. BrewManNH

    Unset a Hotkey ?

    HotKeySet("q")
    1 point
  12. James

    SDL 2.0.0 is released

    SDL 2.0.0 has finally been released. I know this will make a certain MVP very happy. Source.
    1 point
  13. Just tested it, and it works fine for me. WinRAR = the best.
    1 point
  14. $content = FileRead('C:\Documents and Settings\User\My Documents\torrents\file.torrent') $start = StringInStr($content, 'length') $end = StringInStr($content, ':', 0, 1, $start) $size = StringMid($content, $start, $end - $start)
    1 point
×
×
  • Create New...