-
Posts
471 -
Joined
-
Last visited
Everything posted by Madza91
-
Get pixel color from hiden image
Madza91 replied to Madza91's topic in AutoIt General Help and Support
Bump! -
Hello, I'm not much good in this, but I made some little script for checking Online Gold Price, and reading value number from image. But, I want hide image and get just number, without showing image. How? Thank you. script example: ;----- example 3 PNG work araund by Zedna #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #include <StaticConstants.au3> Opt("PixelCoordMode", 2) Global $link = "http://goldprice.org/NewCharts/gold/images/gold_1d_k_EUR.png" Global $saveto = @TempDir & "\goldprice.png" Global $hGUI, $hImage, $hGraphic Global $ImageX = 20, $ImageY = 53 #NoTrayIcon ; Create GUI $hGUI = GUICreate("Gold Price Live!", 220, 263) GUICtrlCreateLabel("Gold Price Live!", 0, 0, 220, 30, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFFFFFF) $Pic1 = GUICtrlCreatePic("", 0, 30, 253, 2, -1, $WS_EX_STATICEDGE) GUICtrlCreateGroup("", 8, 36, 204, 189) $Pic1 = GUICtrlCreatePic("", 19, 52, 182, 116, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER)) $label = GUICtrlCreateLabel("Gold Price: " &@CRLF& "Change: ", 20, 174, 180, 48) $button = GUICtrlCreateButton("Update", 58, 233, 75, 23) $button1 = GUICtrlCreateButton("Izlaz", 139, 233, 75, 23) ; Load PNG image _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($saveto) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUISetState() GUICtrlSetData($label, "Gold Price: " & _CitanjeBrojeva($ImageX+50, $ImageY+4) &@CRLF& "Change: " & _CitanjeBrojeva($ImageX+130, $ImageY+4)) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $button1 Exit Case $button _UpdateGoldPrice() EndSwitch WEnd ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ; Draw PNG image Func MY_WM_PAINT($hWnd, $msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, $ImageX, $ImageY) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT Func _CitanjeBrojeva($x, $y, $x1 = 80) Local $text, $broj, $proba, $1 For $a = 0 To $x1 $broj = _GetRow($x+$a, $y) $proba = _GetRow($x+$a+4, $y) $proba1 = _GetRow($x+$a-1, $y) If $proba1 = "00000000" Then Switch $broj Case "01111110";0 If $proba = "01111110" Then $text &= 0 Case "01000001";1 If $proba = "00000001" Then $text &= 1 Case "01000011";2 If $proba = "01100001" Then $text &= 2 Case "01000010";3 If $proba = "01101110" Then $text &= 3 Case "00001100";4 If $proba = "11111111" Then $text &= 4 Case "11110010";5 If $proba = "10001110" Then $text &= 5 Case "00111110";6 If $proba = "00001110" Then $text &= 6 Case "10000000";7 If $proba = "11000000" Then $text &= 7 Case "01101110";8 If $proba = "01101110" Then $text &= 8 Case "01110000";9 If $proba = "01111100" Then $text &= 9 Case "00000011";dot If _GetRow($x+$a+1, $y) = "00000000" Then $text &= "." Case "00000010";UP If $proba = "00111110" Then GUICtrlSetColor($label, 0x008000) Case "00100000";DOWN If $proba = "00111110" Then GUICtrlSetColor($label, 0xFF0000) EndSwitch EndIf $broj = "" Next Return $text EndFunc Func _GetRow($x, $y = 0) Local $1, $2 For $a = 0 To 7 $2 = PixelGetColor($x, $y+$a, $hGUI) $color1 = Hex($2, 6) If $color1 = "FFFFFF" Then $1 &= "0" Else $1 &= "1" EndIf Next Return $1 EndFunc Func _UpdateGoldPrice() Local $hDownload, $nBytes GUICtrlSetState($button, $GUI_DISABLE) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) $hDownload = InetGet($link, $saveto, 1, 1) Do Sleep(250) Until InetGetInfo($hDownload, 2) ; Check if the download is complete. $nBytes = InetGetInfo($hDownload, 0) InetClose($hDownload) ; Close the handle to release resources. If $nBytes <> 0 Then $hImage = _GDIPlus_ImageLoadFromFile($saveto) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, $ImageX, $ImageY) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) GUICtrlSetData($label, "Gold Price: " & _CitanjeBrojeva($ImageX+50, $ImageY+4) &@CRLF& "Change: " & _CitanjeBrojeva($ImageX+130, $ImageY+4) &@CRLF& "Updated: " & @HOUR &":"& @MIN) Else MsgBox(0,$nBytes, "Error") EndIf GUICtrlSetState($button, $GUI_ENABLE) EndFunc EDIT: Or just what function can I use for getting color from custom pixel of some loaded image?
-
Little problem with Show-Hide Window...
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
Ok, if it's still there, but it's just much faster, how to slow down that and return it to its default speed? -
Little problem with Show-Hide Window...
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
It's not point that GUI are always hiding and showing, that's ok, but effect on 2nd time and all times after that of showing isn't OK... GUI just show for me, without effect -.- -
Hello. I want to add PNG image to my ImageList for ListView Items... But I see that can be only added icons and bitmaps, why isn't possible to add png images? Or if possible, I how to do that? #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> Opt('MustDeclareVars', 1) $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hImage, $hListView GUICreate("ListView Set Image List", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState() ; Load images $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_Add($hImage, @DesktopDir & "\favicons.png") ;~ _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) _GUICtrlListView_AddColumn($hListView, "Column 1", 100) _GUICtrlListView_AddItem($hListView, "Item 1", 0) _GUICtrlListView_AddItem($hListView, "Item 2", 1) _GUICtrlListView_AddItem($hListView, "Item 3", 2) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main *Note: You need file "favicons.png" on Desktop... Here is one:
-
Little problem with Show-Hide Window...
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
I forgot to say, it works first time, and "hide" effect works everytime, but when show GUI 2nd, 3rd... time, then it just have been showed, wihtout effect... -
[SOLVED] Detect click on TrayTip?!
Madza91 replied to Madza91's topic in AutoIt General Help and Support
I think this is right answer, rover fast as always, thank you -
Hello... By default in Windows 7 show and hide of GUI has effect, but when I create 1 GUI and show it and hide it more than one time, it has just first time effect... Does anybody know why? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 406, 175, -1, 100) $Button1 = GUICtrlCreateButton("Show", 128, 96, 75, 25, 0) $Button2 = GUICtrlCreateButton("Hide", 208, 96, 75, 25, 0) GUISetState(@SW_SHOW, $Form1) $Form2 = GUICreate("Form1", 406, 175, -1, 300, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), -1, $Form1) GUISetState(@SW_HIDE, $Form2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUISetState(@SW_SHOWNOACTIVATE, $Form2) Case $Button2 GUISetState(@SW_HIDE, $Form2) EndSwitch WEnd
-
[SOLVED] Detect click on TrayTip?!
Madza91 replied to Madza91's topic in AutoIt General Help and Support
Hello... This is good, but it doesn't work every time, I don't know why... It doesn't send notifications sometimes... I will see TTM_ACTIVATE notification tomorrow... Or some other solution, if you know something more, please post it... Thank you Rover! -
Hello, I know this question is asked many many times, but all answers on that questions aren't right solution for this... I have several example scripts for detecting click on TrayTip, but it's all bad solutions... Example 1: #include <Constants.au3> #include <GuiToolTip.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Dim $iInterval = 8, $iInit Dim $iMSInterval = $iInterval * 1000 Dim $aWindows, $hShell_TrayWnd TrayTip('Title', 'Text', $iInterval) $aWindows = WinList('[CLASS:tooltips_class32]') $hShell_TrayWnd = WinGetHandle('[CLASS:Shell_TrayWnd]') For $i = 1 To $aWindows[0][0] If _WinAPI_GetParent($aWindows[$i][1]) = $hShell_TrayWnd And _ BitAND(_WinAPI_GetWindowLong($aWindows[$i][1], $GWL_STYLE), $WS_VISIBLE) Then ExitLoop EndIf Next $iInit = TimerInit() While TimerDiff($iInit) <= $iMSInterval If Not _GUIToolTip_ToolExists($aWindows[$i][1]) Then MsgBox(64, 'Notification', 'ToolTip was clicked') ExitLoop EndIf Sleep(50) WEndoÝ÷ ØLZ^Õ×yËlrXÓ¬î·^ÉbrJ'^Ú¶¶²¶*m«Z¨§±¬¬Ýý±ÉbrGnëpyÚ'ßÛgyçm«DÅ©©íºÚ"µÍYÕ^UØZ] ][ÝÕÝ ][ÝË ][ÝÐÛXÚÈYI][ÝË LJH[ÙÐÞ ][ÝÔÝ[ ][ÝË ][ÝÖ[ÝHÛXÚÙY] ÌÌÎÉ][ÝÊBQ^][ÙBÙÐÞ ][ÝÔÝ[ ][ÝË ][ÝÕ[YIÌÎNÜÈ ÌÌÎÉ][ÝÊB[YÚ[HBTÛY L BÑ[[ÈÕ^UØZ] ÌÍÜ×Õ^U]K ÌÍÜ×Õ^U^ ÌÍÚWÕ[YSÝ] ÌÍÚWÓÜ[ÛH BØØ[ ÌÍÚWÔ]X]Ú[ÙHHÜ ][ÝÕÚ[]SX]Ú[ÙI][ÝË BØØ[ ÌÍÚWÔÝ[Y ÌÍØUÚ[ÝÜË ÌÍÚÕ^U ÌÍØÐÛXÚÙYHY ÌÍÜ×Õ^U^H ][ÝÉ][ÝÈ[^U ][ÝÉ][ÝË ][ÝÉ][ÝËÌ B[ÙB ÌÍÚWÔÝ[YH[Y[] B^U ÌÍÜ×Õ^U]K ÌÍÜ×Õ^U^Ì ÌÍÚWÓÜ[ÛB ÌÍØUÚ[ÝÜÈHÚ[Ý ][ÝÖÐÓTÔÎÛÛרÛÜÌÌI][ÝÊBÜ ÌÍÚVHHÈ ÌÍØUÚ[ÝÜÖÌVÌBY]S Ú[Ù]Ý]J ÌÍØUÚ[ÝÜÖÉÌÍÚVVÌWJKH[ ÌÍÚÕ^UH ÌÍØUÚ[ÝÜÖÉÌÍÚVVÌWB^]ÛÜ[Y^Ú[H]S Ú[Ù]Ý]J ÌÍÚÕ^U KH[ [YY ÌÍÚWÔÝ[YH È L ÌÍÚWÕ[YSÝ] JBÛY L BÑ[Y[YY ÌÍÚWÔÝ[YH È L ÌÍÚWÕ[YSÝ] H[ÛÛÛÛUÜ]J ][ÝÐÛXÚÙY] ][ÝÈ [È[YY ÌÍÚWÔÝ[YH [ÈÔB ÌÍØÐÛXÚÙYHB[ÙBÛÛÛÛUÜ]J ][ÝÓÝÛXÚÙY[ÙY ][ÝÈ [È[YY ÌÍÚWÔÝ[YH [ÈÔB^U ][ÝÉ][ÝË ][ÝÉ][ÝËL B ÌÍØÐÛXÚÙYH[Y[YÜ ][ÝÕÚ[]SX]Ú[ÙI][ÝË ÌÍÚWÔ]X]Ú[ÙJB] ÌÍØÐÛXÚÙY[[ÈÏOIÝ×Õ^UØZ] Very ugly way and has same mistake like Example 1 & 2...
-
Hello... I'm just wondering is it possible to connect autoit to Facebook Chat and how?
-
That's good too!
-
Wow! That's great! It really working! Thank you
-
I looked at that topics, and there is not any working solution. I tried that "cdtray_routines", and it gave me closing error (with Don't send button)...
-
Hello... I need to detect when is opened/closed CD Rom, is it possible somehow? Thanks.
-
Gui Titlebar Right click - Context menu disable?!
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
Hehe I solved that too: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $SC_MOVE = 0xF010; Global Const $SC_MOVE2 = 0x0F012; Global Const $SC_CLOSE = 0xF060; Global Const $SC_CLOSE2 = 0xF063; Global Const $SC_MENU = 0xF093; Global Const $SC_KEYMENU = 0xF100; Global Const $SC_MOUSEMENU = 0xF090; $hGUI = GUICreate("With Context Menu", 250, 400, 100, -1, -1, $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) GUIRegisterMsg(0x00A4, "aaa") GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND") While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Func aaa() Return 0 EndFunc Func WM_SYSCOMMAND($hWndGUI, $MsgID, $wParam, $lParam) Switch $wParam Case $SC_MOVE, $SC_MOVE2 If $hWndGUI = $hGUI Then Return 0 Case $SC_CLOSE, $SC_CLOSE2 Exit Case $SC_MENU, $SC_MOUSEMENU, $SC_KEYMENU Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc -
Gui Titlebar Right click - Context menu disable?!
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
Nice solution too, thx -
Gui Titlebar Right click - Context menu disable?!
Madza91 replied to Madza91's topic in AutoIt GUI Help and Support
I found solution: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("With Context Menu", 250, 400, 100, -1, -1, $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) GUIRegisterMsg(0x00A4, "aaa") While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Func aaa() Return 0 EndFunc -
Hello... Is possible to disable Context menu on GUI's TitleBar? I need to disable Context Menu on GUI's Titlebar, but I need X button on GUI too... Is there some style for GUI, or some way to disable Right click on Titlebar? Here is little demo script: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("With Context Menu", 250, 400, 100, -1, -1, $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) $hGUI2 = GUICreate("Without Context Menu (but without X (exit button) too", 320, 400, 360, -1, $WS_CAPTION, $WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd
-
Oh... they can't have same param. Thx
-
Hello again... I found some bug with "_GUICtrlListView_InsertItem" Func. When I use "GUICtrlCreateListViewItem" for adding items in ListView, then Sorting works, but when add items with "_GUICtrlListView_InsertItem" then Sord don't work... Why? Here is example script: (Funcs for adding items is Line 13/14) #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hListView GUICreate("ListView Sort", 300, 200) $hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180) For $a = 0 To 3 ;~ GUICtrlCreateListViewItem("Line " & $a + 4, $hListView) _GUICtrlListView_InsertItem($hListView, "Line " & $a) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") _GUICtrlListView_RegisterSortCallBack($hListView) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlListView_UnRegisterSortCallBack($hListView) GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) _GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem")) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
-
Authenticity, thank you I solved it Zedna, your LogView is nice
-
Hello, I need to put "arrow" in Column title when is column clicked... like in ScreenShot: I know to detect when is Column Clicked , put I don't know to show that arrow (who shows sort direction) Can someone help me to made this? Here is script with detection ColumnClick and sorting: #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work Global $hListView, $B_DESCENDING _Main() Func _Main() GUICreate("ListView SimpleSort", 400, 300) $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268) GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("line4|5|more_a", $hListView) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($hListView)] ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked MsgBox(0,"ColumnClick", "Column is clicked.") _GUICtrlListView_SimpleSort($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem")) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
-
In that version isn't possible to edit that in options, but I'm working at new version with many more options, and it will be very easy-to-use...
-
Background of icon is black instead transparent?!
Madza91 replied to Madza91's topic in AutoIt General Help and Support
Solved. I forgot to set color options for _GUIImageList_Create()