Guest Posted March 8, 2013 Share Posted March 8, 2013 (edited) Hello!i worte with your help a script that change the Audio Volume of the Speakers and it is work in windows 7 and i think it also work on win vista and 8 too.. you need to test it.the script change the volume by hotkeys.image:the part of set the hotkeys Not yet built. you need to change it in the code.i didn't built this part becouse it is the small problam and i will deal with it later.the big problem is with the graphic display when the script show the new volume.There are three problems:1) the graphic text is un activate the window that you on.. it is open like a activate GUI window. it shuld open as unactivate..2) the text Not disappeared when you stop Increase or low the volume.3) if you will Increase or low the volume again you will get this fail:i uploaded the script becouse it must came with Some UDFs for the Volume.i hope you help me to fix those problamsthanks for helpers!change volume by gil900.rar Edited March 8, 2013 by Guest Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 8, 2013 Share Posted March 8, 2013 (edited) Here is a help script expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstants.au3> HotKeySet("{ESC}", "Exit_") ;set exit event $hWin = GUICreate("Volume Changer", 200, 250, -1, -1, $WS_POPUP, BitOR($WS_EX_TRANSPARENT, $WS_EX_TOPMOST)) ;Bkcolor and Transparency WinSetTrans($hWin, '', 255) GUISetBkColor(0x767777) ;------------------------- ;Create labels GUICtrlCreateLabel("X - Press ESC", 10, 10) GUICtrlSetDefBkColor(-2) GUICtrlCreateLabel("The Volume is 25%", 50, 111, 100, 50) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetFont(-1, 10, 800, 4) $iLbl_Timer = GUICtrlCreateLabel("", 10, 225, 180, 25) ;Set Timer to close the GUI $iTimer = 5000 ;millisecs $hTimer = TimerInit() ;Set No Focus stealing state GUISetState(@SW_SHOWNOACTIVATE) Local $iMsg, $iTimer_Ret Do $iMsg = GUIGetMsg() $iTimer_Ret = TimerDiff($hTimer) Sleep(10) GUICtrlSetData($iLbl_Timer, StringFormat("GUI will close after %dsecs", $iTimer / 1000 - $iTimer_Ret / 1000)) Until $iMsg = $GUI_EVENT_CLOSE Or $iTimer_Ret > $iTimer Func Exit_() GUIDelete() Exit EndFunc ;==>Exit_ For help with your code you have to show it Regards Edited March 8, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
guinness Posted March 8, 2013 Share Posted March 8, 2013 (edited) Honestly there are hundreds of ways you could be creating that text, hence why PhoenixXL was kind enough to create one variation, which I suspect isn't how you do it. Edited March 8, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2013 Share Posted March 8, 2013 (edited) i forgot to upload the file.. I uploaded it now Edited March 8, 2013 by Guest Link to comment Share on other sites More sharing options...
FireFox Posted March 8, 2013 Share Posted March 8, 2013 Honestly there are hundreds of ways you could be creating that text, hence why PhoenixXL was kind enough to create one variation, which I suspect isn't how you do it.He already opened on how to draw the text...@gil900_WinAPI_RedrawWindow Link to comment Share on other sites More sharing options...
PhoenixXL Posted March 8, 2013 Share Posted March 8, 2013 (edited) Done for you Added - No Focus Steal - No Overlapping textsexpandcollapse popup#include <Misc.au3> #include <_AudioEndpointVolume.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{NUMPAD8}", "none") HotKeySet("{NUMPAD2}", "none") HotKeySet("{ESC}", "Terminate") ;Settings $VolumeUpKey = "68" $VolumeDownKey = "62" $PercentChange = 10 ;-->EndSettings Local $Sleep = 80 , $ChangeVolume = False , $Case , $timer , $dif , $SendOne = True , $StartTumer = False , $hDLL = DllOpen("user32.dll") Global $NewVolLevel $a = 0 While 1 Sleep($Sleep) If _IsPressed($VolumeDownKey, $hDLL) Or _IsPressed($VolumeUpKey, $hDLL) Then If $StartTumer = True Then ;MsgBox(0,"","",1) $timer = TimerInit() $SendOne = True $StartTumer = False EndIf If $ChangeVolume = False Then $ChangeVolume = True If _IsPressed($VolumeUpKey, $hDLL) Then $Case = 1 If _IsPressed($VolumeDownKey, $hDLL) Then $Case = 2 Else If $ChangeVolume = True Then $ChangeVolume = False If $StartTumer = False Then $StartTumer = True EndIf If $ChangeVolume = True Then $dif = TimerDiff($timer) If $dif > 800 Then ChangeVolume(2,$Case) EndIf Else If $dif > 0 Then If $dif < 800 Then ChangeVolume($PercentChange,$Case) EndIf EndIf If $dif > 0 Then $dif = 0 EndIf WEnd Func ChangeVolume($Percent,$Case) Static $hGUI = 0 $VolLevel = _GetMasterVolumeLevelScalar() $VolLevel = StringSplit($VolLevel,".",1) If $VolLevel[0] > 1 Then If StringLeft($VolLevel[2],2) > 50 Then $VolLevel[1] = $VolLevel[1]+1 EndIf If $Case = 2 Then $percent = $percent*-1 Global $NewVolLevel = $VolLevel[1]+$percent If $NewVolLevel < 0 Then $NewVolLevel = 0 If $NewVolLevel > 100 Then $NewVolLevel = 100 _SetMasterVolumeLevelScalar($NewVolLevel) $hGUI = _TransparentTextWindow("MyTextGUI", "Volume Level: "&$NewVolLevel, 390, 30, @DesktopWidth-390, @DesktopHeight-70, "Arial", 1000, 0x00FF00, -1, -1, -1, 1, False, 0, $hGUI) GUISetState(@SW_SHOWNOACTIVATE) EndFunc Func Terminate() Exit EndFunc Func _TransparentTextWindow($h_WinTitle, $s_WinText, $i_WinWidth, $i_WinHeight, $i_WinXPosn = -1, $i_WinYPosn = -1, _ $s_TextFont = -1, $i_FontWeight = -1, $v_FontColor = -1, $i_FontItalics = 0, $i_FontUnderline = 0, $i_FontStrikeOut = 0, $i_Taskbar = 0, $i_WinExist = False, $i_hwnd = 0, $iPrev_Hwnd = 0) If $iPrev_Hwnd Then GUIDelete( $iPrev_Hwnd ) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ADDED THIS... Local Const $DEFAULT_CHARSET = 0 ; ANSI character set Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 If $h_WinTitle = "" Then $h_WinTitle = "AutoIt Overlayed Window" If $s_WinText = "" Then $s_WinText = "|" If $i_WinWidth < 1 Or $i_WinWidth > @DesktopWidth Then SetError(1) ; window width outside current screen geometry If $i_WinHeight < 1 Or $i_WinHeight > @DesktopHeight Then SetError(1) ; window height outside current screen geometry If $i_WinXPosn = -1 Then $i_WinXPosn = (@DesktopWidth / 2) - ($i_WinWidth / 2) ; center the window horizontally If $i_WinYPosn = -1 Then $i_WinYPosn = (@DesktopHeight / 2) - ($i_WinHeight / 2) ; center the window vertically If $i_WinXPosn < 1 Or $i_WinXPosn > (@DesktopWidth - $i_WinWidth) Then SetError(1) ; window won't fit on current screen geometry If $i_WinYPosn < 1 Or $i_WinYPosn > (@DesktopHeight - $i_WinHeight) Then SetError(1) ; window won't fit on current screen geometry If @error Then Return ; return with @error = 1 If $s_TextFont = "" Or $s_TextFont = -1 Then $s_TextFont = "Microsoft Sans Serif" ; default font If $i_FontWeight = "" Or $i_FontWeight = -1 Then $i_FontWeight = 450 ; default Font weight If $v_FontColor = "" Or $v_FontColor = -1 Then $v_FontColor = "0xFF0000" ; default font colour (red) If $i_FontItalics <> 1 Then $i_FontItalics = 0 ; no italics as default If $i_FontUnderline <> 1 Then $i_FontUnderline = 0 ; no underlining as default If $i_FontStrikeOut <> 1 Then $i_FontStrikeOut = 0 ; no strike out font as default If $i_Taskbar <> 1 Then ; display tray icon if $i_WinExist = False Then Local $h_GUI = GUICreate($h_WinTitle, $i_WinWidth, $i_WinHeight, $i_WinXPosn, _ $i_WinYPosn, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Else Local $h_GUI = WinGetHandle($i_hwnd) EndIf Else ; hide tray icon if $i_WinExist = False Then Local $h_GUI = GUICreate($h_WinTitle, $i_WinWidth, $i_WinHeight, $i_WinXPosn, _ $i_WinYPosn, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) Else Local $h_GUI = WinGetHandle($i_hwnd) EndIf EndIf GUISetBkColor($v_FontColor) Local $hDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $h_GUI) Local $hMyFont = DllCall("gdi32.dll", "hwnd", "CreateFont", "int", $i_WinHeight, _ "int", 0, "int", 0, "int", 0, "int", $i_FontWeight, "int", $i_FontItalics, _ "int", $i_FontUnderline, "int", $i_FontStrikeOut, "int", $DEFAULT_CHARSET, _ "int", $OUT_CHARACTER_PRECIS, "int", $CLIP_DEFAULT_PRECIS, _ "int", $PROOF_QUALITY, "int", $FIXED_PITCH, "str", $s_TextFont) Local $hOldFont = DllCall("gdi32.dll", "hwnd", "SelectObject", "int", $hDC[0], _ "hwnd", $hMyFont[0]) DllCall("gdi32.dll", "int", "BeginPath", "int", $hDC[0]) DllCall("gdi32.dll", "int", "TextOut", "int", $hDC[0], "int", 0, "int", 0, _ "str", $s_WinText, "int", StringLen($s_WinText)) DllCall("gdi32.dll", "int", "EndPath", "int", $hDC[0]) Local $hRgn1 = DllCall("gdi32.dll", "hwnd", "PathToRegion", "int", $hDC[0]) Local $rc = DllStructCreate("int;int;int;int") DllCall("gdi32.dll", "int", "GetRgnBox", "hwnd", $hRgn1[0], _ "ptr", DllStructGetPtr($rc)) Local $hRgn2 = DllCall("gdi32.dll", "hwnd", "CreateRectRgnIndirect", _ "ptr", DllStructGetPtr($rc)) DllCall("gdi32.dll", "int", "CombineRgn", "hwnd", $hRgn2[0], "hwnd", $hRgn2[0], _ "hwnd", $hRgn1[0], "int", $RGN_XOR) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hRgn1[0]) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $h_GUI, "int", $hDC[0]) DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $h_GUI, "hwnd", $hRgn2[0], "int", 1) DllCall("", "int", "SelectObject", "int", $hDC[0], "hwnd", $hOldFont[0]) Return $h_GUI EndFunc ;==>_TransparentTextWindow Func none() EndFunc Edited March 8, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
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