Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/29/2016 in all areas

  1. After a long search I found a few registry keys dat contains the color of the taskbar in windows 10. It's handy for example if you want to make a window in the same color as the taskbar. ConsoleWrite(_Get_taskbar_color()); It return AARRGGBB Func _Get_taskbar_color() If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "ColorPrevalence") Then If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then Return "0xD9" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 16), 6) Else Return "0xFF" & StringLeft(StringRight(RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Accent", "AccentPalette"), 24), 6) EndIf Else If RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize", "EnableTransparency") Then Return "0xD9000000" Else Return "0xFF000000" EndIf EndIf EndFunc Edit: This code doesn't seems to be working on Windows 8 only for Windows 10
    2 points
  2. Jon

    AutoIt (Latest Stable Version)

    Version v3.3.16.1

    50,317 downloads

    This is the current stable version of AutoIt. What's new: Changelog. Main AutoIt download page (for AutoIt and other tools like the script editor).
    1 point
  3. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  4. I think you should start to read the AutoIt help file to understand the basics of the language. You put everything into a string - even the variable. Should be: $geturl = _Excel_RangeRead($oFile, $oFile.Activesheet, "A" & $i)
    1 point
  5. mine is more like let them choose if want to learn or want just the fish till teacher dies. lol Saludos
    1 point
  6. Not exactly the "teach a man to fish" method, @Danyfirex
    1 point
  7. mikell

    (Solved)Parsing text file?

    In the example I used $txt = "27/4/2016 8:15 user1 user2 Hello, how are you ?" There are 5 fields to grab in one sequence. Assuming that the 4 fields date/time/user1/user2 contain no space, you can use \S - everything except space (including newline) - , and \N to grab the rest up to the next newline and with (\S+)\s+ you get only the content of the group
    1 point
  8. @DrAhmed There is an awesome example...in the help file for TimerDiff: Add a TimerInit() to the top of your function, and then a TimerDiff right before your Return statement, done.
    1 point
  9. 6-12% is not that high but for Sleep(1000) it is. I don't know what code is behind ; Here I use TCPSend to send the data to my client Have a look there.
    1 point
  10. 1 point
  11. @DrAhmed look at TimerInit() and TimerDiff() in the help file. You should be able to add that in to each of your functions to get an idea of the time they take.
    1 point
  12. You can do something like this here: #include <GDIPlus.au3> _GDIPlus_Startup() Global $aBitmaps = _GDIPlus_ImageLoadFromMultiPageImage(@ScriptDir & "\Test3.tif") Global $i, $iW = 0, $iH = 0, $iX = 0 For $i = 1 to $aBitmaps[0] $iW += _GDIPlus_ImageGetWidth($aBitmaps[$i]) $iH = _GDIPlus_ImageGetHeight($aBitmaps[$i]) > $iH ? _GDIPlus_ImageGetHeight($aBitmaps[$i]) : $iH Next $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) $iW = 0 For $i = $aBitmaps[0] To 1 Step - 1 _GDIPlus_GraphicsDrawImageRect($hGfx, $aBitmaps[$i], $iW, 0, _GDIPlus_ImageGetWidth($aBitmaps[$i]), _GDIPlus_ImageGetHeight($aBitmaps[$i])) $iW += _GDIPlus_ImageGetWidth($aBitmaps[$i]) Next $sSave = @ScriptDir & "\Test3.gif" _GDIPlus_ImageRotateFlip($hBitmap, 6) _GDIPlus_ImageSaveToFile($hBitmap, $sSave) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) For $i = 1 to $aBitmaps[0] _GDIPlus_BitmapDispose($aBitmaps[$i]) Next _GDIPlus_Shutdown() ShellExecute($sSave) ;code by Eukalyptus Func _GDIPlus_ImageLoadFromMultiPageImage($sPath) Local $hImage = _GDIPlus_ImageLoadFromFile($sPath) If @error Then Return SetError(1, 1, False) Local $iCount = _GDIPlus_ImageGetFrameDimensionsCount($hImage) If Not $iCount Then Return SetError(1, 2, False) Local $aList = _GDIPlus_ImageGetFrameDimensionsList($hImage) If @error Or Not IsArray($aList) Then Return SetError(1, 3, False) Local $iPixelFormat, $iImageW, $iImageH Local $aReturn[1], $iCnt = 0 For $i = 1 To $aList[0] $iCount = _GDIPlus_ImageGetFrameCount($hImage, $aList[$i]) For $j = 1 To $iCount _GDIPlus_ImageSelectActiveFrame($hImage, $aList[$i], $j) $iCnt += 1 ReDim $aReturn[$iCnt + 1] $iPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage) $iImageW = _GDIPlus_ImageGetWidth($hImage) $iImageH = _GDIPlus_ImageGetHeight($hImage) $aReturn[$iCnt] = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iImageW, $iImageH, $iPixelFormat) Next Next _GDIPlus_ImageDispose($hImage) $aReturn[0] = $iCnt Return $aReturn EndFunc ;==>_GDIPlus_ImageLoadFromMultiPageImage Func _GDIPlus_ImageGetFrameDimensionsCount($hImage) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "handle", $hImage, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], False) Return $aResult[2] EndFunc ;==>_GDIPlus_ImageGetFrameDimensionsCount Func _GDIPlus_ImageGetFrameDimensionsList($hImage) Local $iI, $iCount, $tBuffer, $pBuffer, $aPropertyIDs[1], $aResult $iCount = _GDIPlus_ImageGetFrameDimensionsCount($hImage) If @error Then Return SetError(@error, @extended, -1) $tBuffer = DllStructCreate("byte[" & $iCount * 16 & "]") $pBuffer = DllStructGetPtr($tBuffer) $aResult = DllCall($__g_hGDIPDll, "int", "GdipImageGetFrameDimensionsList", "handle", $hImage, "ptr", $pBuffer, "int", $iCount) If @error Then Return SetError(@error, @extended, -1) If $aResult[0] Then Return SetError(10, $aResult[0], False) ReDim $aPropertyIDs[$iCount + 1] $aPropertyIDs[0] = $iCount For $iI = 1 To $iCount $aPropertyIDs[$iI] = _WinAPI_StringFromGUID($pBuffer) $pBuffer += 16 Next Return $aPropertyIDs EndFunc ;==>_GDIPlus_ImageGetFrameDimensionsList
    1 point
  13. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Get the sections of the ini file Global $aSections = IniReadSectionNames(@DesktopDir & "\Scripts\BatteryConfig.ini") ; If the IniReadSectionNames succeeded, conver the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1] If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd You can use _ArrayToString to convert the array of sections to a string separated by a pipe (|) that you can use for GUICtrlSetData. I started the _ArrayToString at row 1 since the first element in the $aSections array is the # of sections (Useless information for a combobox).
    1 point
  14. Melba23

    imagesearch2015

    zachary, Other than $x & $y you do not assign values to the parameters when calling _ImageSearch, neither do you initially assign a value to $waitSecs within your start function. I suggest you fix that first and see what happens then. M23
    1 point
  15. Melba23

    imagesearch2015

    Zachary, Another section of the rules says: so please stop doing that right away. How do you expect us to help you when the error appears to occur inside the ImageSearch2015 include file and we have no idea of what code is involved? Our crystal balls are pretty good on occasion, but this is well beyond their capabilities. You let us see the content of that file - why not cut and paste from the file itself (see here how to do it) - and then we might be able to get somewhere. M23
    1 point
  16. Melba23

    imagesearch2015

    zachary, I strongly suggest that you find the time very soon - particularly the section which reads: M23
    1 point
  17. @DrAhmed: Search the forum for "_GDIPlus_StreamImage2BinaryString" and you will find several examples how to use it in different scenarios. You even replied here:
    1 point
  18. Melba23

    imagesearch2015

    zachary, Welcome to the AutoIt forums. Where did you find the ImageSearch2015 include file? And looking at the name of the image for which you are searching, please make sure you read our Forum rules before you post again. M23
    1 point
  19. btw. If you are using MS SQL DBMS then try this: Local $oConnection = _ADO_Connection_Create() _ADO_Connection_OpenMSSQL($oConnection,$sServer,$sDatabase,$sUser,$sPassword) If @error Then Return SetError(@error, @extended, $ADO_RET_FAILURE)
    1 point
  20. rootx, Remove the GUICtrlSetImage call from within the handler and place it in the If $bChanged Then section: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> Global $bChanged = False $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0xE0FFFF) $Pic = GUICtrlCreatePic("Your jpg", 0, 0, 1024, 600) GUICtrlSetState(-1, $GUI_DISABLE) $cLV = GUICtrlCreateListView("Column 1", 10, 10, 200, 200) $hLV = GUICtrlGetHandle($cLV) For $i = 0 To 19 GUICtrlCreateListViewItem("Item " & $i, $cLV) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If $bChanged Then $j = _GUICtrlListView_GetSelectedIndices($hLV) ConsoleWrite($j & @CRLF) $bChanged = False GUICtrlSetImage($Pic, "Your jpg") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hLV $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK $tStruct = DllStructCreate($tagNMITEMACTIVATE, $lParam) $Index = DllStructGetData($tStruct, "Index") Local $iItemText = _GUICtrlListView_GetItemText($cLV, DllStructGetData($tStruct, "Index"), 1) $item = StringSplit(_GUICtrlListView_GetItemTextString($cLV, $Index), '|') $item = $item[1] ConsoleWrite($item & @CRLF) $bChanged = True ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $LVN_KEYDOWN $tStruct = DllStructCreate($tagNMLVKEYDOWN, $lParam) $iKey = DllStructGetData($tStruct, "VKey") Switch $iKey Case 38, 40 $bChanged = True EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY M23
    1 point
  21. Thanks, czardas! I appreciate the confirmation.
    1 point
  22. The short answer is yes for strings. For numbers no because the size is what counts.
    1 point
  23. Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFilename = "Converted.jpg") ;coded by UEZ 2013 build 2013-09-14 Local $sImgCLSID, $tGUID, $tParams Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Local $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) _GDIPlus_BitmapDispose($hBitmap) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFilename, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString It's a hard function to find on the forums, so I have it saved on my computer.
    1 point
  24. Malkey

    Searching 2D arrays

    For the sake of curiosity - the array method took 159ms, and, the regular expression took 29ms. The Array method. ;ConsoleWrite(FileRead("NL.txt") & @LF) #include <Array.au3> #include <File.au3> Local $hTimer = TimerInit() Local $Struct[12] = ["country code", "postal code", "place name", "admin name1", "admin code1", "admin name2", "admin code2", "admin name3", "admin code3", "latitude ", "longitude ", "accuracy "] Global $aArray, $sRet Local $sSearch = 3033 _FileReadToArray(@ScriptDir & '\NL.txt', $aArray, $FRTA_COUNT, @TAB) $i = _ArraySearch($aArray, $sSearch, 0, 0, 0, 0, 1, 1) For $j = 0 To UBound($aArray, 2) - 1 $sRet &= $Struct[$j] & ":" & @TAB & $aArray[$i][$j] & @CRLF Next ConsoleWrite(TimerDiff($hTimer) & @LF) MsgBox(0, "Postcode: " & $sSearch, $sRet) ;_ArrayDisplay($aArray) The Regular Expression method. ;ConsoleWrite(FileRead("NL.txt") & @LF) #include <Array.au3> Local $hTimer = TimerInit() Local $iPostCode = 3033 ; 8263 ; 1336 ; 9401 ; ; Find row with specific postcode $a = StringRegExp(FileRead("NL.txt"), _ '(?i)([A-Z]+)' & @TAB & _ ; country code : iso country code, 2 characters ("NL" - Netherlands) '+(' & $iPostCode & ')' & @TAB & _ ; Postal code : varchar(20)ostcode '+([A-Z (),\-]*)' & @TAB & _ ; place name : varchar(180) '+([A-Z \-]*)' & @TAB & _ ; admin name1 : 1. order subdivision (state) varchar(100) '+(\d*)' & @TAB & _ ; admin code1 : 1. order subdivision (state) varchar(20) '+([A-Z \-]*)' & @TAB & _ ; admin name2 : 2. order subdivision (state) varchar(100) '+(\d*)' & @TAB & _ ; admin code2 : 2. order subdivision (state) varchar(20) '+([A-Z \-]*)' & @TAB & _ ; admin name3 : 3. order subdivision (state) varchar(100) '+(\d*)' & @TAB & _ ; admin code3 : 3. order subdivision (state) varchar(20) '+([\d\.]+)' & @TAB & _ ; latitude : estimated latitude (wgs84) '+([\d\.]+)' & @TAB & _ ; longitude : estimated longitude (wgs84) '+(\d+)' _ ; accuracy : accuracy of lat/lng from 1=estimated to 6=centroid , 3) ConsoleWrite(TimerDiff($hTimer) & @LF) _ArrayDisplay($a)
    1 point
  25. czardas

    Switch vs. Select

    Cool analogy, but I think of Switch as a whole guitar and Select as a whole guitar shop. Local $vGuitar = 'more expensive model', $vDuffer = 'cheap guitar', $iDollars = Random(100, 140, 1) Switch $vGuitar Case 'more expensive model' ; get a good quality guitar case Case Else Select Case $vDuffer = 'cheap guitar' And $iDollars <= 120 ; check out the more expensive model Case Else ; pay in installments EndSelect EndSwitch
    1 point
  26. spudw2k

    Switch vs. Select

    No new info here, but I tend to think of it this way. A switch statement acts...like a switch....doy.... Think of a multiple state toggle switch; a pickup selector switch on a guitar makes for a decent example. When the switch is moved, it is evaluated based on the discrete value/condition and outputs as designed/programmed. A select statement could be seen as the whole guitar. If I turn the volume nob, adjust volume output...if I adjust a tuning peg, tighten or loosen string...if I plug in guitar...you get the idea.
    1 point
×
×
  • Create New...