Jump to content

PhoenixXL

MVPs
  • Posts

    1,487
  • Joined

  • Last visited

  • Days Won

    3

PhoenixXL last won the day on May 3 2013

PhoenixXL had the most liked content!

2 Followers

About PhoenixXL

  • Birthday January 14

Profile Information

  • Member Title
    be what you are, its always the BEST..
  • Location
    India
  • Interests
    Programming,
    Basketball+cricket

Recent Profile Visitors

2,400 profile views

PhoenixXL's Achievements

  1. Then the discussion comes to some point I'm having 3.3.10.2 But my syntax checker(also tidy) always crashes whenever it is run through scite upon execution of the script. Upon running the syntax checker explicitly I get the errors you pointed out. I will correct it in the upcoming version (additionally I will reinstall Autoit to clarify the errors) Regards
  2. I'm running scite v3.3.0 but I don't think that's giving the errors.
  3. The following works for me #include <Array.au3> Local Const $String = "1, 2, 3, 4, 5, 1, 2, 3, 4, 5" ConsoleWrite(@AutoItVersion & @CRLF) _ArrayDisplay(StringSplit($String, ", ", 3), "Array Original") _ArrayDisplay(_ArrayUnique(StringSplit($String, ", ", 3), Default, Default, Default, 0), "Array Unique") ; Display the unique array. Console Output: 3.3.10.2 The function definition Func _ArrayUnique(Const ByRef $aArray, $iColumn = Default, $iBase = Default, $iCase = Default, $iFlags = Default) If $iColumn = Default Then $iColumn = 1 If $iBase = Default Then $iBase = 0 If $iCase = Default Then $iCase = 0 If $iFlags = Default Then $iFlags = 1 ; Start bounds checking If UBound($aArray) = 0 Then Return SetError(1, 0, 0) ; Check if array is empty, or not an array ; $iBase can only be 0 or 1, if anything else, return with an error If $iBase < 0 Or $iBase > 1 Or (Not IsInt($iBase)) Then Return SetError(2, 0, 0) If $iCase < 0 Or $iCase > 1 Or (Not IsInt($iCase)) Then Return SetError(2, 0, 0) If $iFlags < 0 Or $iFlags > 1 Or (Not IsInt($iFlags)) Then Return SetError(4, 0, 0) Local $iDims = UBound($aArray, 0), $iNumColumns = UBound($aArray, 2) If $iDims > 2 Then Return SetError(3, 0, 0) ; checks the given dimension is valid If ($iColumn < 1) Or ($iNumColumns = 0 And ($iColumn - 1 > $iNumColumns)) Or ($iNumColumns > 0 And ($iColumn > $iNumColumns)) Then Return SetError(3, 0, 0) ; make $iColumn an array index, note this is ignored for 1D arrays $iColumn -= 1 ; create dictionary Local $oD = ObjCreate("Scripting.Dictionary") ; compare mode for strings ; 0 = binary, which is case sensitive ; 1 = text, which is case insensitive ; this expression forces either 1 or 0 $oD.CompareMode = Number(Not $iCase) Local $vElem ; walk the input array For $i = $iBase To UBound($aArray) - 1 If $iDims = 1 Then ; 1D array $vElem = $aArray[$i] Else ; 2D array $vElem = $aArray[$i][$iColumn] EndIf ; add key to dictionary ; NOTE: accessing the value (.Item property) of a key that doesn't exist creates the key :) ; keys are guaranteed to be unique $oD.Item($vElem) Next ; ; return the array of unique keys If BitAND($iFlags, 1) = 1 Then Local $aTemp = $oD.Keys() _ArrayInsert($aTemp, 0, $oD.Count) Return $aTemp Else Return $oD.Keys() EndIf EndFunc ;==>_ArrayUnique In the helpfile there is no mention of the ByRef type, in the definition though it is. I wonder how it still works for me.
  4. Why not wait for the change and then get the items at one go. This would take the same CPU but only at the time when update occurs, or maybe you can modify it to suit you rather better. The following way to proceed, may help, For a third party app, to monitor messages you would have to use _WinAPI_SetWindowsHookEx with $WH_CALLWNDPROCRET Hook the ListView Monitor message LVM_SETITEM LVM_INSERTITEM Respond to the message, and do your stuff. Example in C++ In the moment I can't try for if it works. Regards Phoenix XL
  5. Use WM_PAINT to draw on the GUI, orelse with your code try to minimize + restore you will find that all the graphics disappear. For your question check the function CheckPointer in the example. Example #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGraphic, $hBrush, $hBrushFont, $hFont, $hFormat, $hFamily, $hGUI, $tRect_Coords[4] ;would be used in two functions therefore declared as global. Global $iTheme = 0 Example() Func Example() ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) ; Fill a rectangle _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBrush = _GDIPlus_BrushCreateSolid(0xAA43A6DF) $hBrushFont = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI Light") $hFont = _GDIPlus_FontCreate($hFamily, 20, 2) $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ;Register for painting GUIRegisterMsg($WM_PAINT, "WM_PAINT") ;$WM_PAINT GUISetState() ; Loop until the user exits. Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN If CheckPointer($tRect_Coords) Then SetTheme(1) Case $GUI_EVENT_PRIMARYUP SetTheme(0) Case $GUI_EVENT_MOUSEMOVE If GetTheme() = 1 Then ContinueLoop If CheckPointer($tRect_Coords) Then SetTheme(2) Else SetTheme(0) EndIf EndSwitch Until 0 ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrushFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ;Your Code must lie below ;Paint the string _GDIPlus_GraphicsClear($hGraphic, 0xFFF0F0F0) _GDIPlus_GraphicsFillRect($hGraphic, $tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3], $hBrush) _GDIPlus_GraphicsDrawStringEx($hGraphic, "Hello world", $hFont, _GDIPlus_RectFCreate($tRect_Coords[0], $tRect_Coords[1], $tRect_Coords[2], $tRect_Coords[3]), $hFormat, $hBrushFont) ;End of your code _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return 0;'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func CheckPointer(ByRef $aiCoords_ClientRel) Return _WinAPI_PtInRectEx(_WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI), $aiCoords_ClientRel[0], $aiCoords_ClientRel[1], $aiCoords_ClientRel[2] + $aiCoords_ClientRel[0], $aiCoords_ClientRel[3] + $aiCoords_ClientRel[1]) EndFunc ;==>CheckPointer Func GetTheme() Return $iTheme EndFunc ;==>GetTheme Func SetTheme($Theme, $f_Redraw = true) If GetTheme() = $Theme Then Return 1 If $Theme = 0 Then ;Idle _GDIPlus_BrushSetSolidColor($hBrush, 0xAA43A6DF) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Default Dimensions $tRect_Coords[0] = 10 $tRect_Coords[1] = 10 $tRect_Coords[2] = 100 $tRect_Coords[3] = 100 ElseIf $Theme = 1 Then ;MouseDown _GDIPlus_BrushSetSolidColor($hBrush, 0xFF3685B2) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Compress a Bit $tRect_Coords[0] = 12 $tRect_Coords[1] = 12 $tRect_Coords[2] = 96 $tRect_Coords[3] = 96 ElseIf $Theme = 2 Then ;MouseOver _GDIPlus_BrushSetSolidColor($hBrush, 0xBB7BC1E9) _GDIPlus_BrushSetSolidColor($hBrushFont, 0xFFFFFFFF) ;Enlarge a Bit $tRect_Coords[0] = 8 $tRect_Coords[1] = 8 $tRect_Coords[2] = 104 $tRect_Coords[3] = 104 Else Return SetError(1, 0, 0) EndIf $iTheme = $Theme ConsoleWrite("CurTheme: " & $iTheme & @CRLF) If $f_Redraw Then _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INTERNALPAINT, $RDW_ERASE)) endfunc ;==>SetTheme Thumbs up if it helped. Regards Phoenix XL
  6. v1.7 released. Changed: Searching with regular expressions. Requires Autoit v3.3.10.2(latest one for the time being). Idub, check the Autoit version you are having.
  7. Don't know exactly but, The >UDF by trancexx will surely make you start
  8. In your case GDIPlus isn't required. The following would also do the same. #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> HotKeySet("{END}", "Terminate") $GUI = GUICreate("", 147, 145, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $pic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0,0,147, 145) GUISetState() Local Const $iTransparency = 50 GUISetBkColor(0xABCDEF) ;this background color should be same as the trans color used in above function _WinAPI_SetLayeredWindowAttributes($GUI,0xABCDEF, $iTransparency) ;~ GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc The precise comparison, can only be given by an expert. I'm still very amateur in it. Regards Phoenix XL
  9. The following would work. Note that Child Windows can't have WS_EX_LAYERED till windows 7, ==> the problem in your first example Note: windows 8 supports WS_EX_LAYERED with child windows. Also WS_EX_TRANSPARENT doesn't allow a window to be transparent, it only allows click through, ie the underlying window would be receiving mouse input but an overlay of the given window would be shown. You can set the transparency of WS_EX_LAYERED windows using functions(check example) Example #include-once #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISys.au3> HotKeySet("{END}", "Terminate") $GUI = GUICreate("", 147, 145, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $pic = GUICtrlCreatePic("", 0,0,147, 145) Local Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() $himg=_GDIPlus_ImageLoadFromFile("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif") $hbmp=_GDIPlus_BitmapCreateHBITMAPFromBitmap($himg) _GDIPlus_ImageDispose($himg) _WinAPI_DeleteObject(GUICtrlSendMsg($pic,$STM_SETIMAGE,$IMAGE_BITMAP,$hbmp)) GUISetState() Local Const $iTransparency = 50 GUISetBkColor(0xABCDEF) ;this background color should be same as the trans color used in above function _WinAPI_SetLayeredWindowAttributes($GUI,0xABCDEF, $iTransparency) ;~ GUISetState(@SW_SHOW,$gui) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else EndSelect WEnd Exit Func Terminate() exit(0) EndFunc Regards Phoenix XL
  10. Didn't knew about that Anyways I'm getting conflicting results, is it the same for all #include <WinAPIShPath.au3> $sTest = "http://testinghg.com/" _U($sTest) $sTest = "http://test/21-04-2014" _U($sTest) Func _U($URL) MsgBox(0, $URL, "URLIs: " & _WinAPI_UrlIs ($sTest) & @CRLF & "IE: " & ((InetGetSize($sTest) = 0) ? "0" : "1")) EndFunc ;==>_U That must be the conflicting results, then. I think, these methods won't solve the problem, we will have to prefer something like on libcURL. InetGetInfo has never given me wrong results(till now at least) therefore I had relied on it. Regards Phoenix XL
  11. Example $sURL = "http://test/21-04-2014" InetGetSize($sURL) If @error Then ConsoleWrite("Invalid URL" & @CRLF) Else ConsoleWrite("Valid URL" & @CRLF) EndIf Regards Phoenix XL
  12. No, I am changing it for the reason that all the items are enumerated at once and if the list of items is very large, then obviously its gonna take some time, and create a lag in the displaying of the list, causing further unpredictable problems that occur when the return of the procedure is not fast. So, I would be probably doing it by, First enumerate the no. of items that will be displayed at once (depends on the height of the suggestion box, and individual item's height) Then enumerate single item further from that index in an elapse of say 10ms until all items are entered. Plus in the second enumeration phase I won't redraw the suggestion, as it would by default be done when the user scrolls down. That would save some of the time. Please put forward, what you all think about it. Regards Phoenix XL
  13. Fixed the two of the bugs (courtesy - Lupo73 and theTony). Check the first post for more information. I was delaying for the reason of finding out a way to make asynchronous finding of the text in the list, so as to populate words efficiently when the size is more than 1000(as posted by ValeryVal). I could find out an appropriate way, but now I'm running out of time to implement it in the UDF. For the time being, I had fixed up the bugs. Regards Phoenix XL
  14. But terenary operator is working from v3.3.10.* Can you give the output of the code MsgBox(0, 0, @AutoItVersion) Regards
×
×
  • Create New...