Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. IniReadSectionNames error ???

    Possibly contains BOM. Configure editor accordingly (or use $FO_UTF8_NOBOM for FileOpen()) on INI file creation.
  3. _SQL.au3. ADODB.Connection

    This is related to connection string and firewall on sql server.
  4. Hi Pricehacker Jos is certainly right. It seems that your 1st PixelSearch() is successful, it creates a a two-element array of pixel's coordinates $aCoord[0] and $aCoord[1] $aCoord = PixelSearch($aPos[2]*0.654436860068259,$aPos[3]*0.687953555878084,$aPos[2],$aPos[3],15983675) As @error = 0 , then you enter in the While...Wend loop, the While statement executes correctly the 1st time, but now your new PixelSearch during the While...Wend loop isn't successful : $aCoord = PixelSearch($aPos[2]*0.65,$aPos[3]*0.688,$aPos[2],$aPos[3],15983675) It redefines $aCoord to 0, so the Array is gone and your script ends suddenly because there is no more Array, but a simple variable, in the following line : While PixelGetColor($aCoord[0],$aCoord[1])... After you fix this, may I suggest the use of variables for your @error statements, as it's dangerous to test @error in many places of the script because it's easily reset to 0 when any function is called Good luck
  5. Today
  6. SimpleSQL_UDF

    My pleasure bud... along with the angst part This will definitley be useful, hopefully I will get a chance to use your UDF soon
  7. _ArrayReverse & _ArrayToString woes

    @jimdaway Not for case I suggested you to use _GUICtrlListBox_InsertString(), since, instead of sorting the items in the ListBox as _GUICtrlListBox_AddString() does, items are added at the end of the ListBox if the Index is set as -1.
  8. IniReadSectionNames error ???

    Can you please post the INI file you're using? If I make an INI file out of the text you posted, it works fine, so there may be something wrong with your file.
  9. _ArrayReverse & _ArrayToString woes

    You need to create your listbox without the default $LBS_SORT style set. ListBoxes are set to sort by default, and you need to make sure that isn't set.
  10. Install latest AutoIt (you are using a version which does not have that constant defined), or replace $STR_NOCOUNT by 2.
  11. Hi Seams IniReadSectionNames does not show all Sections names (First one is missing ... [Site Information]) My code Local $aSections=IniReadSectionNames($ThisIni) $ThisIni : [Site Information] Equipment ID:=539456593 Customer Name:=CH Address: =- City State:=Town Country:=France Phone:= Zip Code:=24000 Product Type:=Master [Computer] Computer Name=CHPRODFR Hardware Manufacturer=HP Hardware Model=ProLiant ML350 Gen9 Processor=Intel(R) Xeon(R) CPU E5-2643 v3 @ 3.40GHz Number of memory modules=4 Total Memory size=32 GB BIOS version=P92 [Physical Disk Details] 1=2.00 TB [Logical Disk Details] C:\=63.6 GB D:\=2062.1 GB F:\=872.8 GB [NIC Details] Embedded LOM 1 Port 1=00:10:6F:C5:FD:8E Hospital-LAN=70:10:6F:C5:FD:8E [Graphic Card Details] DriverDate=20150826 DriverVersion=4.1.2.2 Name=Matrox G200eh (HP) WDDM 1.2 Status=OK VideoProcessor=Matrox G200eH [Memory Card Details] 8192=752368-081 8192=752368-081 8192=752368-081 8192=752368-081 [Missing Components] [Non-standard Components] [Installed Hotfixes] $aSections Row|Col 0 [0]|9 [1]|Computer [2]|Physical Disk Details [3]|Logical Disk Details [4]|NIC Details [5]|Graphic Card Details [6]|Memory Card Details [7]|Missing Components [8]|Non-standard Components [9]|Installed Hotfixes
  12. RegExp

    Hi. The examples (in the library) in the 7z-file are all something like that: [z--z] Íàéòè ïîâòîð ñëîâà (?<![^\s\A])([À-ÿ¨¸]+)[\h]+\1 33 Ýòîò øàáëîí ïîçâîëÿåò íàéòè ïîâòîðû ïîâòîðû â ñëîâàõ. Òàêàÿ îøèáêà ÷àñòî âñòðå÷àåòñÿ ó ïèñàòåëåé ïèñàòåëåé ðåäàêòèðóþùèõ ñâîè òåêñòû. Áóäòå îñòîðîæíû, ïîâòîðû íå âñåãäà ÿâëÿþòñÿ îøèáêîé, äà äà. Somebody a hint how to change that? Simpel
  13. SimpleSQL_UDF

    Here is the bare bones of a UDF I have started work on. Mostly just a proof of concept at this stage, and still need to add some functions and dress the UDF up a bit ... to look like a UDF ... though it has my own distinct styling, especially as I have never really developed a UDF before now .... used plenty and modified plenty though. I've even invented my own UDF variable naming convention, which I am sure some of you will be aghast at. I work with what feels best for me, but others are free to adapt if they wish. The idea is to emulate the simplicity of INI files, but gain the benefits of SQL. Two scripts are provided. (1) The UDF, a work in progress - SimpleSQL_UDF.au3 (2) An example or testing script - UDF_Test.au3 Another first for me, is creating a 2D array from scratch, never done that before, that I can recall ... never had a need, and even for 1 dimension arrays, for a long time now, I have just used _StringSplit to create them. So I needed a bit of a refresher course, which my good buddy @TheDcoder assisted me with ... not without some angst I might add. LOL SimpleSQL_UDF.zip Program requires the sqlite3.dll, not included, but easily enough obtained. Hopefully the usage is self-evident ... just change the Job number variable in the UDF_Test.au3 file to check the existing functions out. Enjoy! P.S. This is also related to a new program I have just finished and uploaded - INItoSQL DB
  14. Hi FrancescoDiMuro Thank you for the reply and suggestion. I've done what you suggest and the ListBox still populates in a sorted manner. Here is the code I've implemented. The _GetDirectoryListing() routine just pulls a file list from a local directory and puts each line into a globally defined, 1-dimensional array called $aMasterJobList. I've tried reversing the array and populating it with the For/Next from 0 to UBound and as shown below without the _ArrayReverse. Any idea? _GetDirectoryListing() ;GUICtrlSetData($hJobList, _ArrayToString($aMasterJobList)) _GUICtrlListBox_BeginUpdate($hJobList) For $iI = Ubound($aMasterJobList) - 1 to 0 step -1 _GUICtrlListBox_AddString($hJobList, $aMasterJobList[$iI]) Next _GUICtrlListBox_EndUpdate($hJobList)
  15. Hello, I am currently writing a program that parses a massive table from a website, and need a way to add a progress bar while parsing. I am currently using the function _IETableWriteToArray($oObj, True) to parse the array. I need the progress bar to update as the table is parsed, not just at the end of the parsing. Any help at all would be very much appreciated! *EDIT --> The array I am left with after parsing is $array[0-50000][16]
  16. Thanks, what such $STR_NOCOUNT? At me an error Global $arrStringSplit = StringSplit("https://alpari.com/", "/", $STR_NOCOUNT) Global $arrStringSplit = StringSplit("https://alpari.com/", "/", ^ ERROR
  17. INItoSQL DB

    Here is a simple program that some of you might appreciate. It is a more full fleshed out version of something I worked on a while back as a proof of concept. I will just quote the information found in the Program Information dialog. INItoSQL DB.zip Program requires the sqlite3.dll, not included, but easily enough obtained. I have also included the beginnings of a new UDF (SimpleSQL_UDF) I am working, which you can use with the included 'Check conversion.au3' file to check a resulting conversion ... just modify the values for a few variables to suit your situation.
  18. Chrome Tabs

    Hi, Can any one only give an approval that this last version is running properly Its already at version 1.0.0.8 , Overcoming all former glitches .. * in my tests, if the browser is super busy then it may miss a tab that was intended to be closed, else all otherwise .. * IGWS: if your AV warns you of a virus then don't post back on such a thing (It isn't ) Thanks Deye
  19. _ArrayReverse & _ArrayToString woes

    Why don't you try _GUICtrlListBox_InsertString() ?
  20. Hello all, I've been working on a script that has many dynamically created context menus with icons for specific listview items. Depending on the listview item that was right-clicked, different menu choices are displayed. The best way to do this that I found was to use the "_GUICtrlMenu" UDF functions with WM_NOTIFY and UEZ's awesome _GUICtrlMenu_CreateBitmap function. All in all, things work great until I disable an item that also has an icon. The icon turns all black or discolored instead of having that "disabled" look of being grayed out. I've put together a simple reproducer to show what I'm talking about as well as a pic that displays the disabled icon from my main script Is there any way to make the disabled menu item's icon look grayed out and not black/discolored? Thanks!! #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GUIMenu.au3> #include <WindowsConstants.au3> Global $cDummy Global $hList $hGUI = GUICreate("Disabled Menu Item Test", 500, 300) $cDummy = GUICtrlCreateDummy() $idList = GUICtrlCreateListView("Col1|Col2|Col3", 10, 10, 480, 280) $hList = GUICtrlGetHandle(-1) GUICtrlCreateListViewItem("Test1|Test2|Test3", $idList) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $cDummy _ShowContext($idList) EndSwitch WEnd Func _ShowContext($hWnd) Local Enum $idTest1 = 1000, $idTest2 Local $sIconPath = @ProgramFilesDir & "\AutoIt3\Icons\au3.ico" Local $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Test1" & @TAB & "Ctrl+1", $idTest1) _GUICtrlMenu_SetIcon($hMenu, 0, $sIconPath) _GUICtrlMenu_AddMenuItem($hMenu, "Test2" & @TAB & "Ctrl+2", $idTest2) _GUICtrlMenu_SetIcon($hMenu, 1, $sIconPath); <<<<<<< Any way to make this work with transparency? _GUICtrlMenu_SetItemDisabled($hMenu, 1) Local $idMsg = _GUICtrlMenu_TrackPopupMenu($hMenu, GUICtrlGetHandle($hWnd), -1, -1, 1, 1, 2) Switch $idMsg Case $idTest1 ConsoleWrite(">> Test1" & @CRLF) Case $idTest2 ConsoleWrite(">> Test2" & @CRLF) EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndFunc Func _GUICtrlMenu_SetIcon($hWnd, $iIndex, $sIconPath) Local $hBMP_File_New = _GUICtrlMenu_CreateBitmap($sIconPath, 0, 16, 16) Return _GUICtrlMenu_SetItemBmp($hWnd, $iIndex, $hBMP_File_New) EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iItem Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $HwndFrom = DllStructGetData($tNMHDR, "HwndFrom") Local $iCode = DllStructGetData($tNMHDR, "Code") Switch $HwndFrom Case $hList Switch $iCode Case $NM_RCLICK $iItem = DllStructGetData(DllStructCreate($tagNMITEMACTIVATE, $lParam), "Index") If $iItem <> -1 Then GUICtrlSendToDummy($cDummy) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ; #FUNCTION# ============================================================================================================ ; Name...................: _GUICtrlMenu_CreateBitmap ; Description .......: Extracts the icon from $sFile and converts it to a HBitmap format ; Syntax................: _GUICtrlMenu_CreateBitmap($sFile, $iIndex = 0, $iX = 18, $iY = 18) ; Parameters ......: $sFile - file name where the icon should be extracted from or an image should be loaded (*.dll, *.ico, *.exe, *.jpg, *.png, *.bmp, *.gif, *.tif) ; $iIndex - index of the icon from $sFile ; $iX - set the width of the extracted icon ; $iY - set the height of the extracted icon ; Return values .: Success - handle to a HBITMAP ; Failure - Returns 0 and sets error to 1-7 ; Author ..............: UEZ ; Version .............: v0.70 Build 2012-10-13 beta ; Remarks ...........: Don't forget to use _WinAPI_DeleteObject($<handle to the HBITMAP>) when closing to to release the resources ; ======================================================================================================================= Func _GUICtrlMenu_CreateBitmap($sFile, $iIndex = 0, $iW = 18, $iH = 18) Local $hIcon, $Ret, $hBitmap, $hContext, $bBinary = False Local $aChk = _GDIPlus_ImageGetFlags($sFile) If Not @error Then $bBinary = True If FileExists($sFile) Or $bBinary Then Local Const $iStride = 0, $iPixelFormat = $GDIP_PXF32ARGB, $pScan0 = 0 Local $fext = StringMid($sFile, StringLen($sFile) - 3) If $bBinary Then $fext = "0815" Switch $fext Case ".dll", ".exe", ".ico" Return _WinAPI_GetFileIcon($sFile, $iIndex, $iW, $iH) Case ".jpg", ".png", ".bmp", ".gif", ".tif", "0815" Local $hImage If Not $bBinary Then $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then Return SetError(4, @extended, 0) Else $hImage = $sFile EndIf Local $hBitmap = _GDIPlus_BitmapCreateFromHICON32($hImage) ;~ $Ret = DllCall($__g_hGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) ;~ If @error Then Return SetError(5, @extended, 0) ;~ $hBitmap = $Ret[6] $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($__g_hGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hContext, "int", 7) _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iW, $iH) $hIcon = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_BitmapDispose($hImage) If Not $hIcon Then Return SetError(6, 0, 0) Case Else Return SetError(7, 0, 0) EndSwitch Return $hIcon Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_GUICtrlMenu_CreateBitmap Func _WinAPI_GetFileIcon($sFile, $iIndex = 0, $iW = 18, $iH = 18, $iColor = -1) Local $aRet, $hIcon, $hHBitmap Local $hDC, $hBackDC, $hBackSv $aRet = DllCall('shell32.dll', 'int', 'SHExtractIconsW', 'wstr', $sFile, 'int', $iIndex, 'int', $iW, 'int', $iH, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0) If @error Then Return SetError(6, @extended, 0) $hIcon = $aRet[5] $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) If $iColor = -1 Then $iColor = _WinAPI_GetSysColor($COLOR_MENU) $hHBitmap = _WinAPI_CreateSolidBitmap(0, $iColor, $iW, $iH) $hBackSv = _WinAPI_SelectObject($hBackDC, $hHBitmap) _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, $iW, $iH) _WinAPI_DestroyIcon($hIcon) _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteDC($hBackDC) Return $hHBitmap EndFunc ;==>_GUICtrlMenu_CreateBitmap
  21. I'm struggling with something I'm sure I've missed... I have a 1-dimensional array and I'm populating a ListBox using an _ArrayToString function within the GUICtrlSetData function. If I perform an _ArrayReverse on the array before I execute the _ArrayToString function within the GUICtrlSetData, the list still populates in a sorted order. If I do an _ArrayDisplay, it's showing to be reversed but when I populate the ListBox, it's still sorted! _GetDirectoryListing() _ArrayReverse($aMasterJobList) _ArrayDisplay($aMasterJobList) GUICtrlSetData($hJobList, _ArrayToString($aMasterJobList)) Am I missing a subtle (or not-so subtle) flag somewhere?
  22. Hi guys, I'm learning about GUI's, I'm trying the below code, the idea being if I press the letter "e" while I have the GUI open I want the label color to change to green (I'm using a UDF for label colors). But every time I press "e" on my keyboard I just get a "ding" sound from my speakers and nothing changes with the label. I've looked at using something like "While GUIGetMsg() <> $GUI_EVENT_CLOSE" as I've seen it in other code instead of "While 1", but I don't think it's relevant. #include <GUIConstantsEx.au3>; for GUI... #include <GUIRichLabel.au3>; UDF for rich text label fonts #include <Misc.au3>; for _IsPressed $myLetter = "e" $hGUI = GUICreate("test", 700, 60) $lbl2 = _GUICtrlRichLabel_Create($hGUI, '<font color="purple">' & $myLetter & '</font>', 10, 10); , 260, 25 GUISetState(@SW_SHOW) Local $hDLL = DllOpen("user32.dll") While 1 if _IsPressed(Hex($myLetter), $hDLL) Then While _IsPressed(Hex($myLetter), $hDLL) Sleep(250) WEnd _GUICtrlRichLabel_SetData($lbl2, '<font color="green">' & $myLetter & '</font>') Sleep(2000) DllClose($hDLL) Exit EndIf Sleep(50) WEnd DllClose($hDLL) I am using an array of letters that I'm wanting to do this for, but as I can't get it to work I've stripped it down to the simplest code I can think of to try and get this working first. Appreciate any help. Thanks!
  23. Hello forum please allow me to re-open this almost 10 year old topic... Should I have overlooked a more recent discussion about "How to call an event (only) when a treeview's item's checkbox is checked or unchecked" then please let me know. By reading the discussion from 2009, I am wondering if REALLY it is required to - intercept each and every event of $GUI_EVENT_PRIMARYDOWN anywhere on the GUI - re-engineer (by means of GetMousePos and HitTest) which item (of the treeview) has been clicked I would assume that a (much) more direct solution should exist to only intercept a treeview or even only certain treeviewitem events? I see a wealth of functions in GuiTreeView.au3 (without too much talking however...) so there should be something more straight forward, no? Thanks for your thoughts THN
  24. Exit while loop active

    Thank you, Jos. This is what I need.
  25. Exit while loop active

    This is not really using the Button to Stop/Exit and similar to using HotKeySet(). Jos
  26. Exit while loop active

    Use the event mode for your buttons and logic like this: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Global $total = 1 Global $number Global $Start=0 $Form1 = GUICreate("Form1", 246, 133, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button1 = GUICtrlCreateButton("START", 8, 8, 177, 33) GUICtrlSetOnEvent(-1,"_Start") $Button2 = GUICtrlCreateButton("EXIT", 8, 48, 177, 33) GUICtrlSetOnEvent(-1,"_Exit") $Label1 = GUICtrlCreateLabel("NUMBER : " & $number, 8, 96, 178, 17) GUISetState(@SW_SHOW, $Form1) While sleep(50) if $Start Then For $i = 0 To $total $i = 0 Sleep(100) $number += 1 GUICtrlSetData($Label1, "NUMBER : " & $number) Next EndIf WEnd Func _START() $Start=1 EndFunc Func _EXIT() Exit EndFunc Jos
  27. Exit while loop active

    You could set up a button of your keyboard which, once pressed, stops the script Something like: While Not _IsPressed("SomeKey")    ; Code WEnd
  1. Load more activity
×