rliiack Posted October 7, 2009 Posted October 7, 2009 (edited) This is my first project. It magnifies icons on your desktop when the mouse is close to it. It also emits a sound when magnified.Created for the visually impaired, but please still try itComments and suggestions are welcome!Special thanks to many MVPs and other members in helping me. You guys are the best Edited October 7, 2009 by rliiack My Projects:Smart Icons
rliiack Posted October 7, 2009 Author Posted October 7, 2009 The file is hereSmart Icons.zip My Projects:Smart Icons
billthecreator Posted October 7, 2009 Posted October 7, 2009 Not useful, but nice. [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
UEZ Posted October 7, 2009 Posted October 7, 2009 Magnifying Size is not working properly. When I add e.g. 5, save and enter 1 and save, it is still zoomed. Further high CPU load. Use a sleep in your While-Wend loop. Move variable declaration in While-Wend loop off, e.g. top of your script. Nice idea! UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
rliiack Posted October 7, 2009 Author Posted October 7, 2009 Not useful, but nice.This was designed for visual impaired to see better... But I guess its no use to normal people. My Projects:Smart Icons
rliiack Posted October 7, 2009 Author Posted October 7, 2009 (edited) Magnifying Size is not working properly. When I add e.g. 5, save and enter 1 and save, it is still zoomed.Sorry, I should write it clear enough. The magnifying size is the number you entered times the size you are viewing. So if want it to be smaller, you can put e.g. 0.5.Further high CPU load. Use a sleep in your While-Wend loop. Move variable declaration in While-Wend loop off, e.g. top of your script.Fixed itNice idea!Thanks! Edited October 7, 2009 by rliiack My Projects:Smart Icons
billthecreator Posted October 7, 2009 Posted October 7, 2009 This was designed for visual impaired to see better... But I guess its no use to normal people.Next time state that before i run it, cause then i wouldn't even bother. [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
corgano Posted October 7, 2009 Posted October 7, 2009 (edited) This app even fails at that. It takes far too long to refresh compared to the windows magnifier that has been included in every windwos since 2000. i would look up how that works and do it the same way in autoit. I am working on another project i was going to call smarticons, hope you don't mind. Edited October 7, 2009 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
rliiack Posted October 7, 2009 Author Posted October 7, 2009 This app even fails at that. It takes far too long to refresh compared to the windows magnifier that has been included in every windwos since 2000. i would look up how that works and do it the same way in autoit.I am working on another project i was going to call smarticons, hope you don't mind.Is it really slow too after the mute button is clicked? Because I set it so the system sleep while the complete sound is played.I'll try to make it quicker. My Projects:Smart Icons
rliiack Posted November 24, 2009 Author Posted November 24, 2009 Ok, this one is guaranteed to be better then the last one. It now speaks the icon's name, so turn on your volume! expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <Array.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> #Include <WinAPI.au3> #Include <Misc.au3> HotKeySet("{ESC}","Quit") Global $finalDistance, $msg, $desktop, $iconNumber, $x, $y, $pos, $oPos, $iconPos, $iconPos2, $min, $minIndexPos, $hHandle, $save2, $input2, $checkBox2, $volume2, $iCounter = 0 Global $iFD = 0 Global $OS = @OSVersion If Not IsDeclared("WM_LBUTTONDOWN") Then Global Const $WM_LBUTTONDOWN = 0x0201 If Not IsDeclared("WM_LBUTTONDBLCLK") Then Global Const $WM_LBUTTONDBLCLK = 0x0203 If Not IsDeclared("WM_RBUTTONDOWN") Then Global Const $WM_RBUTTONDOWN = 0x0204 Global $fDblClk = False If $OS = "WIN_XP" Then Global $oZoomHeight=76 Global $oZoomWidth=76 Global $zoomHeight=152 Global $zoomWidth=152 ElseIf $OS = "WIN_VISTA" Then Global $oZoomHeight=86 Global $oZoomWidth=86 Global $zoomHeight=172 Global $zoomWidth=172 EndIf opt("GUIOnEventMode",1) $SI = GUICreate("Smart Icons", 802, 579, 224, 110) GUISetFont(20, 800, 0, "Australian Sunrise") $soundOptions = GUICtrlCreateGroup("Sound Options", 117, 21, 631, 111, -1, $WS_EX_TRANSPARENT) GUICtrlSetFont(-1, 30, 800, 0, "Australian Sunrise") $volume = GUICtrlCreateSlider(133, 77, 343, 64) GUICtrlSetData($volume,80) $checkBox = GUICtrlCreateCheckbox("", 512, 77, 22, 33) $mute = GUICtrlCreateLabel("Mute", 536, 69, 86, 45) GUICtrlSetFont(-1, 27, 800, 0, "Times New Roman") $magnifyingSize = GUICtrlCreateGroup("Magnifying Size", 117, 304, 631, 161) GUICtrlSetFont(-1, 30, 800, 0, "Australian Sunrise") $input = GUICtrlCreateInput("", 168, 368, 182, 81) GUICtrlSetFont(-1, 60, 800, 0, "Australian Sunrise") GUICtrlSetData($input,2) $xLabel = GUICtrlCreateLabel("X", 360, 405, 31, 45) GUICtrlSetFont(-1, 27, 800, 0, "Times New Roman") $Save = GUICtrlCreateButton("Save", 448, 357, 204, 87, $WS_GROUP) GUICtrlSetFont(-1, 33, 800, 0, "Australian Sunrise") GUICtrlCreateGroup("", -99, -99, 1, 1) $Quit = GUICtrlCreateButton("Quit", 288, 475, 273, 92, $WS_GROUP) GUICtrlSetFont(-1, 47, 800, 0, "Australian Sunrise") $transparentOptions = GUICtrlCreateGroup("Transparent Options", 112, 152, 625, 145) GUICtrlSetFont(-1, 30, 800, 0, "Australian Sunrise") $transparency = GUICtrlCreateSlider(128, 224, 337, 41) GUICtrlSetData($transparency,80) $checkBox2 = GUICtrlCreateCheckbox("Checkbox1", 488, 232, 17, 17) $trans = GUICtrlCreateLabel("Transparent", 512, 216, 220, 48) GUICtrlSetFont(-1, 28, 800, 0, "Australian Sunrise") GUISetState(@SW_SHOW) GUICtrlSetOnEvent($Quit, "Quit") _GDIPlus_Startup() While 1 $input2=GUICtrlRead($input) $newCheckBox=GUICtrlRead($checkBox) $volume2=GUICtrlRead($volume) $newCheckBox2=GUICtrlRead($checkBox2) SoundSetWaveVolume($volume2) GUICtrlSetOnEvent($Save, "save") getMousePosition() getIconPositions() Global $distance[$iconNumber] Global $distance2[$iconNumber] For $i=0 To UBound($iconPos) -1 $distance[$i]=((($iconPos2[$i][0]-$x)*($iconPos2[$i][0]-$x))+(($iconPos2[$i][1]-$y)*($iconPos2[$i][1]-$y)))^(1/2) Next For $i=0 To UBound($distance) -1 If $distance[$i]<=100 Then $distance2[$i]=$distance[$i] EndIf Next Local $hit=_GUICtrlListView_HitTest($desktop,-1,-1) accessArrayData() If ($finalDistance[$minIndexPos][0]<300 And $finalDistance[$minIndexPos][0]>0) Or $hit[2]=True Then If $oPos <> $finalDistance[$minIndexPos][1] Then If $iCounter>0 Then GUISetState(@SW_HIDE,$Test) EndIf ; $minIndexPos is an integer ; $finalDistance is a 2D array ;$iconPos is a 2D array $iFD = $finalDistance[$minIndexPos][1] $iSC_X1 = $iconPos[$iFD][0] $iSC_Y1 = $iconPos[$iFD][1] $iDT_X2 = $iconPos[$iFD][0] + $oZoomHeight $iDT_Y2 = $iconPos[$iFD][1] + $oZoomHeight Sleep(25) $hbitmap = _ScreenCapture_Capture("", $iSC_X1, $iSC_Y1, $iDT_X2, $iDT_Y2, False) $Test = GUICreate("Smart Icons",$zoomWidth, $zoomHeight, $iSC_X1, $iSC_Y1, $WS_POPUPWINDOW, $WS_EX_TOPMOST) GUIRegisterMsg($WM_LBUTTONDBLCLK, "_WM_LBUTTONDBLCLK") GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") GUIRegisterMsg($WM_RBUTTONDOWN, "_WM_RBUTTONDOWN") GUISetState(@SW_SHOW) If($newCheckBox2 = $GUI_CHECKED) Then WinSetTrans($Test,"",GUICtrlRead($transparency)*2.5) EndIf $hHandle = ControlGetHandle("Smart Icons","",$Test) $graphics=_GDIPlus_GraphicsCreateFromHWND($hHandle) EndIf $oPos=$iFD $bitmap=_GDIPlus_BitmapCreateFromHBITMAP($hbitmap) $height=_GDIPlus_ImageGetHeight($bitmap) $width=_GDIPlus_ImageGetWidth($bitmap) _GDIPlus_GraphicsDrawImageRectRect($graphics,$bitmap,0,0,$width,$height,0,0,$zoomWidth,$zoomHeight) If $newCheckBox=$GUI_UNCHECKED Then _Talk($iconPos[$iFD][2]) EndIf _WinAPI_DeleteObject($hbitmap) _WinAPI_DeleteObject($bitmap) $iCounter=1 EndIf If $iCounter>0 Then Local $maxA = $iconPos[0][0] for $i=1 To UBound($iconPos)-1 If $iconPos[$i][0]>$maxA Then $maxA = $iconPos[$i][0] EndIf Next If $x>$maxA+$oZoomWidth Then GUISetState(@SW_HIDE,$Test) EndIf EndIf WEnd _GDIPlus_Shutdown() Func getMousePosition() $pos=MouseGetPos() $x=$pos[0] $y=$pos[1] EndFunc Func getIconPositions() $desktop=ControlGetHandle("[CLASS:Progman]","","[CLASS:SysListView32;INSTANCE:1]") $iconNumber=_GUICtrlListView_GetItemCount($desktop) If $iconNumber>0 Then Global $iconPos[$iconNumber][3] Global $iconPos2[$iconNumber][2] For $i=0 To UBound($iconPos) -1 $iconPos[$i][2]=_GUICtrlListView_GetItemText($desktop, $i) If $OS = "WIN_XP" Then $iconPos[$i][0]=_GUICtrlListView_GetItemPositionX($desktop, $i)-19 Else $iconPos[$i][0]=_GUICtrlListView_GetItemPositionX($desktop, $i) EndIf $iconPos[$i][1]=_GUICtrlListView_GetItemPositionY($desktop, $i) $iconPos2[$i][0]=_GUICtrlListView_GetItemPositionX($desktop, $i)+$oZoomWidth/2 $iconPos2[$i][1]=_GUICtrlListView_GetItemPositionY($desktop, $i)+$oZoomHeight/2 Next Else MsgBox(64,"Error","No icons on desktop.", 3) Exit EndIf EndFunc Func Quit() Exit EndFunc Func accessArrayData() Local $counter=0 Global $finalDistance[UBound($distance2)][2] for $i=0 To UBound($distance2) -1 If $distance2[$i]>0 Then $finalDistance[$i][0]=$distance2[$i] $finalDistance[$i][1]=$i EndIf Next _ArraySort($finalDistance,1,0,0,0) If $finalDistance[0][0]=0 Then $counter=0 Else for $i=0 To UBound($finalDistance) -1 If $finalDistance[$i][0]>0 Then $counter+=1 EndIf Next $counter-=1 EndIf $min=$finalDistance[$counter][0] $minIndexPos=_ArraySearch($finalDistance,$min) EndFunc Func save() If $input2=1 Then $zoomHeight=$oZoomHeight $zoomWidth=$oZoomWidth Else $zoomHeight=$oZoomHeight*$input2 $zoomWidth=$oZoomWidth*$input2 EndIf EndFunc Func _Talk($s_text) Local $o_speech $o_speech = ObjCreate("SAPI.SpVoice") $o_speech.Speak($s_text) EndFunc Func _WM_LBUTTONDBLCLK($hWnd, $iMsg, $iwParam, $ilParam) $fDblClk = True getMousePosition() If $x>=$iSC_X1 And $x<=$iSC_X1+$zoomWidth And $y>=$iSC_Y1 And $y<=$iSC_Y1+$zoomHeight Then ControlClick("[CLASS:Progman]","","[CLASS:SysListView32;INSTANCE:1]","left",2,$iconPos2[$iFD][0],$iconPos2[$iFD][1]) EndIf Return $GUI_RUNDEFMSG EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $iwParam, $ilParam) If $fDblClk Then $fDblClk = False Return 0 EndIf getMousePosition() If $x>=$iSC_X1 And $x<=$iSC_X1+$zoomWidth And $y>=$iSC_Y1 And $y<=$iSC_Y1+$zoomHeight Then ControlClick("[CLASS:Progman]","","[CLASS:SysListView32;INSTANCE:1]","left",1,$iconPos2[$iFD][0],$iconPos2[$iFD][1]) EndIf Return $GUI_RUNDEFMSG EndFunc Func _WM_RBUTTONDOWN($hWnd, $iMsg, $iwParam, $ilParam) $fDblClk = True getMousePosition() If $x>=$iSC_X1 And $x<=$iSC_X1+$zoomWidth And $y>=$iSC_Y1 And $y<=$iSC_Y1+$zoomHeight Then ControlClick("[CLASS:Progman]","","[CLASS:SysListView32;INSTANCE:1]","right",1,$iconPos2[$iFD][0],$iconPos2[$iFD][1]) EndIf Return $GUI_RUNDEFMSG EndFunc BUGS: When you click or double click on a icon, the computer sends the message to the icon on the top left corner or the first icon. I don't know why... If anyone finds out, please tell me. Thanks! My Projects:Smart Icons
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now