Jump to content

picea892

Active Members
  • Posts

    691
  • Joined

  • Last visited

About picea892

  • Birthday 09/25/1977

Profile Information

  • Location
    Canada

Recent Profile Visitors

768 profile views

picea892's Achievements

Universalist

Universalist (7/7)

7

Reputation

  1. Cool. I just added a fade border for fun #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_LegalCopyright=funkey #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <GDIPlus.au3> #Include <Array.au3> Global $sFile1 = StringReplace(@AutoItExe, "AutoIt3.exe", "") & '\Examples\GUI\msoobe.jpg' Global $sFile2 = StringReplace(@AutoItExe, "AutoIt3.exe", "") & '\Examples\GUI\mslogo.jpg' Global $hGui = GUICreate("Test", 500, 500) Global $nTab = GUICtrlCreateTab(10, 10,480, 480) GUICtrlCreateTabItem("Tab1") Global $nPic1 = GUICtrlCreatePic($sFile1, 20, 50, 460, 420, 0) GUICtrlCreateLabel("Text-Label", 100, 100, 100, 30) _LabelMakeTranslucent(-1, $nPic1) GUICtrlCreateLabel("This is a translucent label", 100, 335, 200, 31) _LabelMakeTranslucent(-1, $nPic1) GUICtrlCreateLabel("This is a transparent label", 300, 335, -1, -1, 0x201) GUICtrlCreateTabItem("Tab2") Global $nPic2 = GUICtrlCreatePic($sFile2, 20, 50, 460, 420, 0) GUICtrlCreateLabel("Translucent label", 30, 200, 100, 20) _LabelMakeTranslucent(-1, $nPic2, 0x80FFFFFF, 0xFFFF0000) GUICtrlCreateLabel("Transparent label", 30, 250, 100, 20, 0x201) GUICtrlCreateTabItem("") GUISetState() Do Until GUIGetMsg() = -3 Func _LabelMakeTranslucent($nLbl, $nPic, $TransColor = 0x40FFFFFF, $FontColor = 0xFF000000, $iSize = 8, $sFontName = "Arial", $iStyle = 0) Local $sText = GUICtrlRead($nLbl) Local $hLbl = GUICtrlGetHandle($nLbl) Local $hPic = GUICtrlGetHandle($nPic) Local $hImage = _SendMessage($hPic, 371) Local $hParent = _WinAPI_GetParent($hlbl) _WinAPI_SetWindowLong($hLbl, -16, BitOR(_WinAPI_GetWindowLong($hLbl, -16), 512, 14)) Local $aLblPos = ControlGetPos($hParent, "", $hLbl) Local $aPicPos = ControlGetPos($hParent, "", $nPic) _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hImage) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hlbl) Local $hBitmap2 = _GDIPlus_BitmapCloneArea($hBitmap, $aLblPos[0] - $aPicPos[0], $aLblPos[1] - $aPicPos[1], $aLblPos[2], $aLblPos[3]) Local $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap2) $hBitmap2=_fadeborder2($hBitmap2,"0xFFFFFF","33","15") Local $hBrushArea = _GDIPlus_BrushCreateSolid($TransColor) ;_GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $aLblPos[2], $aLblPos[3], $hBrushArea) Local $hBrushText = _GDIPlus_BrushCreateSolid($FontColor) Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFontFamily = _GDIPlus_FontFamilyCreate($sFontName) Local $hFont = _GDIPlus_FontCreate($hFontFamily, $iSize, $iStyle) Local $tLayout = _GDIPlus_RectFCreate(0, $aLblPos[3]/2 - $iSize + 1) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sText, $hFont, $tLayout, $hFormat) DllStructSetData($aInfo[0], 1, ($aLblPos[2] - DllStructGetData($aInfo[0], 3)) / 2) _GDIPlus_GraphicsDrawStringEx($hBackbuffer, $sText, $hFont, $aInfo[0], $hFormat, $hBrushText) Local $hImageNew = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap2) _WinAPI_DeleteObject(GUICtrlSendMsg($nLbl, 370, 0, $hImageNew)) _WinAPI_DeleteObject($hImageNew) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_ImageDispose($hBitmap2) _GDIPlus_BrushDispose($hBrushArea) _GDIPlus_BrushDispose($hBrushText) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFontFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc Func _fadeborder2($hBitmap, $col1, $faded, $depth) $gwt = _GDIPlus_ImageGetWidth($hBitmap) $ght = _GDIPlus_ImageGetHeight($hBitmap) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 4) $fadechange=int($faded/$depth) For $i=0 To $depth $iC1 = StringReplace($col1, "0x", "0x"&$fadechange*$i) Global $hBrush = _GDIPlus_BrushCreateSolid($iC1) _GDIPlus_GraphicsFillRect($hGraphics, $i, $i, $gwt-($i*2), $ght-($i*2), $hBrush) _GDIPlus_BrushDispose($hBrush) Next _GDIPlus_GraphicsDispose($hGraphics) Return $hBitmap EndFunc
  2. Welcome to Autoit. Put your vbs and notepad away....no need for that here. From the autoit site you can download the full install. It has Scite which is a very powerful editor and a compiler called Aut2exe.exe Using that....any autoit script can be turned into an exe. Of course you can use notepad...but Scite is so much better. For the code above a complete working example is. You can run it from scite by pressing F5. Or you can compile it using aut2exe and run it just like any exe. Have fun. #include <Misc.au3> #Include <WinAPI.au3> $dll = DllOpen("user32.dll") Global $onoff=1 While 1 Sleep ( 50 ) If _IsPressed("41", $dll) Then ; A pressed _ShowTaskBar($onoff) elseif _IsPressed("51", $dll) Then ;Q pressed ExitLoop EndIf WEnd DllClose($dll) Func _ShowTaskBar($fShow) if $onoff=0 Then $onoff=1 Else $onoff=0 EndIf Local $hTaskBar If @OSVersion = "WIN_VISTA" or @OSVersion = "WIN_2008" Then _ShowStartButton($fShow) $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "") If $fShow=0 Then _WinAPI_ShowWindow($hTaskBar, @SW_SHOW) Else _WinAPI_ShowWindow($hTaskBar, @SW_HIDE) EndIf EndFunc ;==>_ShowTaskBar Func _ShowStartButton($fShow ) Local $hTaskBar, $hStartButton If @OSVersion = "WIN_VISTA" or @OSVersion = "WIN_2008" Then $hStartButton = _WinAPI_FindWindow("Button", "Start") Else $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "") $hStartButton = ControlGetHandle($hTaskBar, "", "Button1") EndIf If $fShow=0 Then _WinAPI_ShowWindow($hStartButton, @SW_SHOW) Else _WinAPI_ShowWindow($hStartButton, @SW_HIDE) EndIf EndFunc ;==>_ShowStartButton
  3. This is a snippet from a much longer program I created. Maybe it will help you You need from Yashied #include <WindowsConstants.au3> #Include <Constants.au3> #include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <winapi.au3> #include <GuiListView.au3> #include <GDIPlus.au3> #include <GuiImageList.au3> #include <ListViewConstants.au3> #include <INet.au3> #include <String.au3> #Include <Icons.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt("MouseCoordMode", 2) global $listcolour="0x666666" global $quickonoff=0, $view=0, $comparedate=0,$totalappointments Global $listview,$listview2, $hImage,$listviewGui _starting() func _starting() Global $listviewGui = GUICreate("listviews", 420, 150, -1, -1, $WS_POPUP,$WS_EX_TOOLWINDOW) internetlinks() GUISetState(@SW_SHOWNOACTIVATE, $listviewGui) EndFunc while 1 Sleep (1000) WEnd Func _Main() Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES) Global $inireference="files.ini" $listview = GUICtrlCreateListView("", 0, 0, 420, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) GUICtrlSetBkColor(-1,$listcolour) GUICtrlSetFont(-1,10,400,0,"Verdana") _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles) ; Load images $hImage = _GUIImageList_Create(16, 16, 5, 3) $longest=0 For $j = 1 To $names[0] $sections = IniReadSection(@scriptdir&"\files.ini", $names[$j]) if $sections[0][0]>$longest then $longest=$sections[0][0] Next $sections = IniReadSection(@scriptdir&"\files.ini", $names[1]) For $i = 1 To $longest if $sections[0][0]>=$i then if FileExists(@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp") then _GUIImageList_AddBitmap($hImage,@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp") Else _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110) EndIf Else _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 50) EndIf Next For $j = 2 To $names[0] $count2=0 Global $sections = IniReadSection(@scriptdir&"\files.ini", $names[$j]) For $i = 1 To $sections[0][0] if FileExists(@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp") then _GUIImageList_AddBitmap($hImage,@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp") Else _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110) EndIf Next Next _GUICtrlListView_SetImageList($listview, $hImage, 1) $count=0 $longest=0 For $j = 1 To $names[0] _GUICtrlListView_AddColumn($listview, $names[$j], 136) $sections = IniReadSection(@scriptdir&"\files.ini", $names[$j]) if $sections[0][0]>$longest then $longest=$sections[0][0] Next $sections = IniReadSection(@scriptdir&"\files.ini", $names[1]) For $i = 1 To $longest if $sections[0][0]>=$i then _GUICtrlListView_AddItem($listview, $sections[$i][0],$count) Else _GUICtrlListView_AddItem($listview, "", $count) EndIf $count=$count+1 Next For $j = 2 To $names[0] $count2=0 Global $sections = IniReadSection(@scriptdir&"\files.ini", $names[$j]) For $i = 1 To $sections[0][0] _GUICtrlListView_AddSubItem($listview, $count2, $sections[$i][0], $j-1, $count) $count2=$count2+1 $count=$count+1 Next Next GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") EndFunc ;==>_Main func internetlinks() _GDIPlus_Startup () Global $names = IniReadSectionNames(@scriptdir&"\files.ini") For $j = 1 To $names[0] ; ConsoleWrite($names[$j]&@CRLF) ; if not $names[$j]="tools" then Global $sections = IniReadSection(@scriptdir&"\files.ini", $names[$j]) For $i = 1 To $sections[0][0] if FileExists(@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp") then ContinueLoop $itsago=get_favicon($sections[$i][1],$sections[$i][0]) $image = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".ico") ; ConsoleWrite(@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".ico") $t = _GDIPlus_EncodersGetCLSID ("bmp") _GDIPlus_ImageSaveToFileEx ($image,@ScriptDir & "\favicon\favicon_" & $sections[$i][0]&".bmp",$t) Next ; EndIf Next _GDIPlus_Shutdown () _Main() EndFunc Func get_favicon($favicon_page, $filenamed) if not FileExists(@scriptdir&"\favicon") then DirCreate(@scriptdir&"\favicon") If not FileExists(@ScriptDir & "\favicon\favicon_" & $filenamed&".ico") Then dim $searcharray[5]=[".com",".ca",".org",".net",".edu"] for $i=0 to UBound($searcharray)-1 $stringpos=StringInStr($favicon_page,$searcharray[$i]) if $stringpos<>0 Then $favicon_page=StringTrimRight($favicon_page,(stringlen($favicon_page)-($stringpos+StringLen($searcharray[$i])-1))) ;get first page EndIf Next $hDownload1 = InetGet($favicon_page & "/favicon.ico", @ScriptDir & "\favicon\favicon_" & $filenamed&".ico") If not FileExists(@ScriptDir & "\favicon\favicon_" & $filenamed&".ico") Then $source = _INetGetSource($favicon_page) $resultarray = _StringBetween($source, 'href="', '"') If IsArray($resultarray) Then For $i = 0 To UBound($resultarray) - 1 ; ConsoleWrite($resultarray[$i] & @CRLF) If StringInStr($resultarray[$i], ".ico") Then if StringLeft($resultarray[$i],1)="/" then $resultarray[$i] = $favicon_page & $resultarray[$i] $hDownload1 = InetGet($resultarray[$i], @ScriptDir & "\favicon\favicon_" & $filenamed&".ico") ; ConsoleWrite($favicon_page) ExitLoop EndIf Next EndIf EndIf If FileExists(@ScriptDir & "\favicon\favicon_" & $filenamed&".ico") Then Return True Else Return False EndIf EndIf return "Already Exists" EndFunc ;==>get_favicon Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event If $wParam = $ListView Then $tagNMHDR = DllStructCreate("int;int;int", $lParam) $event = DllStructGetData($tagNMHDR, 3) If $event = $NM_CLICK Then $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $Number=DllStructGetData($tInfo, "SubItem") $col1 = _GUICtrlListView_GetItemText($ListView,_GUICtrlListView_GetNextItem($ListView),$Number) $inireference="files.ini" $names = IniReadSectionNames(@scriptdir&"\"&$inireference) For $j = 1 To $names[0] $count2=0 Global $sections = IniReadSection(@scriptdir&"\"&$inireference, $names[$j]) For $i = 1 To $sections[0][0] if $col1=$sections[$i][0] then _GUICtrlListView_SetItemSelected ($ListView, -1, 0) ShellExecute($sections[$i][1]) Return $GUI_RUNDEFMSG EndIf Next Next elseIf $event = $NM_RCLICK Then $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $Number=DllStructGetData($tInfo, "SubItem") $col1 = _GUICtrlListView_GetItemText($ListView,_GUICtrlListView_GetNextItem($ListView),$Number) $names = IniReadSectionNames(@scriptdir&"\"&$inireference) For $j = 1 To $names[0] $count2=0 Global $sections = IniReadSection(@scriptdir&"\"&$inireference, $names[$j]) For $i = 1 To $sections[0][0] ;ConsoleWrite("C:\applications\opera10\opera.exe "&$sections[$i][1]&@crlf) if $col1=$sections[$i][0] then if FileExists("C:\applications\opera10\opera.exe") then _GUICtrlListView_SetItemSelected ($ListView, -1, 0) ShellExecute("C:\applications\opera10\opera.exe",$sections[$i][1]) Return $GUI_RUNDEFMSG endif EndIf Next Next EndIf elseIf $wParam = $ListView2 Then $tagNMHDR = DllStructCreate("int;int;int", $lParam) $event = DllStructGetData($tagNMHDR, 3) If $event = $NM_CLICK Then $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $Number=DllStructGetData($tInfo, "SubItem") $col1 = _GUICtrlListView_GetItemText($ListView2,_GUICtrlListView_GetNextItem($ListView2),$Number) $inireference="folders.ini" $names = IniReadSectionNames(@scriptdir&"\"&$inireference) For $j = 1 To $names[0] $count2=0 $sections = IniReadSection(@scriptdir&"\"&$inireference, $names[$j]) For $i = 1 To $sections[0][0] if $col1=$sections[$i][0] then _GUICtrlListView_SetItemSelected ($ListView2, -1, 0) ShellExecute($sections[$i][1]) Return $GUI_RUNDEFMSG EndIf Next Next EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; files.ini [Autoit] Forum=http://www.autoitscript.com/forum/ [Newspaper] The Globe and Mail=http://www.theglobeandmail.com/ [Programs] File hippo=http://www.filehippo.com Opera=http://www.opera.com/
  4. agreed.... I did it with a pic...it can be done with an extracted icon using a script
  5. I'm glad you said you were "almost" certain #include <GDIPlus.au3> global $nottranscolour="0x000066" While 1 $nottranscolour="0x000066" PicSetGraphics(32, 32) sleep(1000) ; check every 5 minutes $nottranscolour="0x990000" PicSetGraphics(32, 32) sleep(1000) ; check every 5 minutes WEnd Func PicSetGraphics($iW, $iH) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local $hWnd, $hBitmap, $hImage, $hGraphic, $hBrush, $hBrush1, $hbmp, $aBmp _GDIPlus_Startup() ;Buffer $hBitmap = _WinAPI_CreateSolidBitmap(0, $nottranscolour, $iW, $iH) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $sText = @MDAY $hBrush1 = _GDIPlus_BrushCreateSolid(_InvertColor($nottranscolour,0)) $hFormat = _GDIPlus_StringFormatCreate(0) $hFamily = _GDIPlus_FontFamilyCreate("Verdana") $hFont = _GDIPlus_FontCreate($hFamily, 14, 0, 3) $tLayout = _GDIPlus_RectFCreate(0, 4, 32,32) ; increase 300 to 380 for one line of text $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sText, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sText, $hFont, $tLayout, $hFormat, $hBrush1) $hIcon = _GDIPlus_BitmapCreateHICONFromBitmap($hImage) ; Create an ico file from the image _CreateIconFileFromHICON($hIcon, @ScriptDir & "\trayicon.ico") $_mday=@MDAY ; Destroy the HICON now I've finished with it. _WinAPI_DestroyIcon($hIcon) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TraySetIcon(@ScriptDir & "\trayicon.ico") _GDIPlus_ImageDispose($hImage) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush1) ; _GDIPlus_BrushDispose($hBrushLin) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hbmp) _WinAPI_DeleteObject($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>PicSetGraphics Func _GDIPlus_BitmapCreateHICONFromBitmap($hBitmap) Local $hIcon $hIcon = DllCall($ghGDIPDll, "int", "GdipCreateHICONFromBitmap", "hwnd", $hBitmap, "int*", 0) If @error Then Return SetError(@error, 0, -1) Return SetError($hIcon[0], 0, $hIcon[2]) EndFunc ;==>_GDIPlus_BitmapCreateHICONFromBitmap Func _CreateIconFileFromHICON($hIcon, $sOutIcon) Local $aInfo, $sIco, $sBmp, $hCDC, $tBI, $tBits, $iSz, $sBD, $FO $sIco = "0x000001000100" $sBmp = "28000000" $aInfo = _WinAPI_GetIconInfo($hIcon) $hCDC = _WinAPI_CreateCompatibleDC(0) $tBI = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBI, "Size", DllStructGetSize($tBI)) _WinAPI_GetDIBits($hCDC, $aInfo[5], 0, 0, 0, DllStructGetPtr($tBI), 0) $sIco &= Hex(DllStructGetData($tBI, "Width"), 2) & Hex(DllStructGetData($tBI, "Height"), 2) & "00000100" & _RB(Hex(DllStructGetData($tBI, "BitCount"), 4)) $sBmp &= _RB(Hex(DllStructGetData($tBI, "Width"))) & _RB(Hex(DllStructGetData($tBI, "Height") * 2)) & "0100" & _RB(Hex(DllStructGetData($tBI, "BitCount"), 4)) & "00000000" $iSz = DllStructGetData($tBI, "SizeImage") $tBits = DllStructCreate("byte[" & DllStructGetData($tBI, "SizeImage") & "]") DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $aInfo[5], 'int', $iSz, 'ptr', DllStructGetPtr($tBits)) For $i = DllStructGetData($tBI, "SizeImage") + 1 To 0 Step -(DllStructGetData($tBI, "SizeImage") / DllStructGetData($tBI, "Height")) $sBD &= StringTrimLeft(BinaryMid(DllStructGetData($tBits, 1), $i, (DllStructGetData($tBI, "SizeImage") / DllStructGetData($tBI, "Height"))), 2) Next $tBits = 0 $tBI = 0 $tBI = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBI, "Size", DllStructGetSize($tBI)) _WinAPI_GetDIBits($hCDC, $aInfo[4], 0, 0, 0, DllStructGetPtr($tBI), 0) _WinAPI_DeleteDC($hCDC) $iSz += DllStructGetData($tBI, "SizeImage") $sBmp &= _RB(Hex($iSz)) & "00000000000000000000000000000000" $sIco &= _RB(Hex($iSz + 40)) & _RB(Hex("22")) & $sBmp & $sBD $tBits = DllStructCreate("byte[" & DllStructGetData($tBI, "SizeImage") & "]") DllCall('gdi32.dll', 'int', 'GetBitmapBits', 'ptr', $aInfo[4], 'int', DllStructGetData($tBI, "SizeImage"), 'ptr', DllStructGetPtr($tBits)) For $i = DllStructGetData($tBI, "SizeImage") + 1 To 0 Step -(DllStructGetData($tBI, "SizeImage") / DllStructGetData($tBI, "Height")) $sIco &= StringTrimLeft(BinaryMid(DllStructGetData($tBits, 1), $i, (DllStructGetData($tBI, "SizeImage") / DllStructGetData($tBI, "Height"))), 2) Next ; Write the icon to a file. $FO = FileOpen($sOutIcon, 18) FileWrite($sOutIcon, Binary($sIco)) FileClose($FO) ; Clear the structs $tBits = 0 $tBI = 0 EndFunc ;==>_CreateIconFileFromHICON ; Reverse Byte String Func _RB($sByte) Local $aX = StringRegExp($sByte, "(.{2})", 3), $sX = '' For $i = UBound($aX) - 1 To 0 Step -1 $sX &= $aX[$i] Next Return $sX EndFunc ;==>_RB Func _InvertColor($iColor, $mode = 1) Switch $mode Case 0 Return "0xFF" & Hex(0xFFFFFF - $iColor, 6) Case 1 Return "0xFF" & StringRegExpReplace(Hex($iColor, 6), "(.{2})(.{2})(.{2})", "\3\2\1") Case 2 Return "0xFF" & StringRegExpReplace(Hex(0xFFFFFF - $iColor, 6), "(.{2})(.{2})(.{2})", "\3\2\1") EndSwitch EndFunc ;==>_InvertColor
  6. Hmmm. if Uez's work doesn't meet your needs, I think you might be looking to add more gui's in a layered sort of fashion. An extreme example that demonstrates my point....I think this is not a good approach but throw it in just for a laugh. #include <WindowsConstants.au3> Global $array[255] $j = 300 For $i = 0 to 255 - 1 $array[$i] = guicreate("Title", 2, 300, $j, 300,$WS_POPUP+$WS_DISABLED,$WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) WinSetTrans($array[$i], "", $i) guisetstate() $j += 1 next While 1 Sleep(100) WEnd
  7. Glad I could help. You have one awesome script there...I need to study it.
  8. This may help you ;#include <FontConstants.au3> Global Const $NONANTIALIASED_QUALITY = 3 GUICtrlSetFont($viewTable, 14, 550, Default, "Arial", $NONANTIALIASED_QUALITY)
  9. Look again...that was only part of it. There is a child gui where the controls are being housed that is not semitransparent.
  10. Awesome effect! This is the only way I know how to do it. #include <gdiplus.au3> #include <winapi.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> Global Const $STM_SETIMAGE = 0x172 $hGui = GuiCreate("Test Skin Functions",-1,200,-1,-1,$WS_POPUP) _SetGuiRoundCorners($hGUI, 40,false,true,true,false) _CreateCustomBk($hGui, 0x550555) _CreateCustomGroupPic(100,100,200,75,0xff0000) WinSetTrans("Test Skin Functions","",150) GuiSetState() $hGui_child = GuiCreate("Test Skin Functions",-1,200,-1,-1,$WS_POPUP,BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD),$hGui) GuiCtrlCreateLabel("TEST LABEL HERE!!!",50,50,120,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) GuiCtrlCreateLabel("AND HERE!!!",150,150,100,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hGui_child, 0xABCDEF, 255) GuiSetState() Do Until GuiGetMsg() = -3 Func _CreateCustomBk($hGui, $hexColor) Local $iWidth = _WinAPI_GetClientWidth($hGui) Local $iHeight = _WinAPI_GetClientHeight($hGui) Local $iPic = GuiCtrlCreatePic("", 0,0,$iWidth,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0xAA"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0 ,$iWidth ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$iWidth - 6 ,$iHeight - 6, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0x22FFFFFF) local $iTimes = round($iWidth/50) local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][1] = $iHeight $aPoints[2][1] = $iHeight $aPoints[4][1] = 0 $aPoints[3][1] = 0 For $i = 0 to $iTimes local $Random1 = random(0,$iWidth,1) local $Random2 = random(30,50,1) $aPoints[1][0] = $Random1 $aPoints[2][0] = $Random1 + $Random2 $aPoints[4][0] = $aPoints[1][0] + 50 $aPoints[3][0] = $aPoints[2][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) $aPoints[1][0] -= $Random2/10 $aPoints[2][0] = $Random1 + $Random2 - ($Random2/10*2) $aPoints[3][0] = $aPoints[2][0] + 50 $aPoints[4][0] = $aPoints[1][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) Next local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _CreateCustomGroupPic($ix, $iy, $Width, $iHeight, $hexColor) Local $iPic = GuiCtrlCreatePic("", $ix,$iy,$Width,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($Width, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0x55"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, $ix, $iy ,$Width ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$Width- 4 ,$iHeight-4, $hBrush) local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR ) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2]-1, $aGuiSize[3]-1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCorners
  11. I suppose 3 seconds has to be 3 seconds every time... I'm not satisfied with this solution because this is not the case. But I believe you need to play with adlibregister or put a sleep in your main loop and count the times looped through to get to 3 seconds. Good luck Local $colourarray[9]=[0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff] local $tempaddress[1][4]=[[0,0,0,0]] Global $itsago=10 AdlibRegister("waiting",3000) While 1 for $i=0 to (UBound($colourarray)-1) $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, $colourarray[$i]) If IsArray($pixelSearch) = 1 and $itsago=10 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) $itsago=0 ContinueLoop EndIf Next WEnd Func waiting() if $itsago=10 then Return if $itsago=0 then $itsago=1 ToolTip("waiting") Else $itsago=10 ToolTip("") EndIf ConsoleWrite($itsago&@crlf) EndFunc
  12. So you come to this forum after not even attempting to learn to code....You have very very obvious mistakes in your code. The code obviously isn't yours and the code is likely for something game related....so why are we to help you? Local $colourarray[9]=[0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff,0xef4a3c,0xeeFbff] While 1 for $i=0 to (UBound($colourarray)-1) $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, $colourarray[$i]) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) ContinueLoop EndIf Next WEnd
  13. Hi, my attempts at buttons are here. Take a look if you like Backgrounds that can be buttons
  14. More complicated but removes the red....alternatively you can use Yashied "icons" UDF No way to +1 me etc....a thank you is all that's needed..Cheers. #include <GUIConstantsEx.au3> #include <GDIPlus.au3> $Main = GUICreate('Some GUI', 200, 100) $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif') $Button = GUICtrlCreatePic('', 10, 35, 74,21) GUICtrlSetCursor(-1,0) iconbutton_1($Button) GUISetState() Do $msg = GUIGetMsg() $hov=GUIGetCursorInfo() if $hov[2]=1 and $hov[4]=$Button then MsgBox(0, "","Button Pressed") sleep(50) Until $msg = $GUI_EVENT_CLOSE Func iconbutton_1($control) _GDIPlus_Startup() $hwd = GUICtrlGetHandle($control) $width = _WinAPI_GetClientWidth($hwd) $height = _WinAPI_GetClientHeight($hwd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwd) $hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic) $hBitmap1 = _ImageDrawicon($hBitmap1,@ScriptDir&'/paypal.gif',74,21) $hBMP1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) _WinAPI_DeleteObject(GUICtrlSendMsg($control, 0x0172, 0, $hBMP1)) _WinAPI_DeleteObject($hBMP1) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc Func _ImageDrawicon($hImage, $picture, $iW, $iH, $iX = 0, $iY = 0) $hGraphic1 = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow()) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic1) $hGraphic2 = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hImage, 0, 0, $iW, $iH) Global $icon = _GDIPlus_ImageLoadFromFile($picture) _GDIPlus_GraphicsDrawImageRect($hGraphic2, $icon, $iX, $iY, $iW, $iH) _GDIPlus_GraphicsDispose ($hGraphic2) _GDIPlus_GraphicsDispose ($hGraphic1) Return $hBitmap EndFunc
  15. Better explanations will generate better help...Perhaps this is the code you need. #include <GUIConstantsEx.au3> $Main = GUICreate('Some GUI', 200, 100) $hDownload1 = InetGet('https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif',@ScriptDir&'/paypal.gif') $Button = GUICtrlCreatePic(@ScriptDir&'/paypal.gif', 10, 35, 74,21) GUISetState() Do $msg = GUIGetMsg() $hov=GUIGetCursorInfo() if $hov[2]=1 and $hov[4]=$Button then MsgBox(0, "","Button Pressed") sleep(50) Until $msg = $GUI_EVENT_CLOSE
×
×
  • Create New...