therks Posted August 10, 2006 Share Posted August 10, 2006 (edited) Hey, there are two windows I've been wanting to be able to bring up with scripts, but the only way I can figure out how to activate them is via the system tray icons.Does anybody know how I can bring up either of these windows via command line, or executable, etc?And also, does anybody know a way I can have AutoIt target tray balloon popups, check what they say, and then close them? Everytime I log on to my laptop, or connect/disconnect the power when there's no wireless network in range I get a tray balloon telling me it can't find a network. I have the "Notify me when this connection has limited or no connectivity" checkbox in the connection properties unchecked, I don't know why it still feels the need to tell me everytime.Anyway, thanks for reading, and for any advice/help people can give.PS - Does anyone ever get around to doing up some UDFs for global volume controls? I remember it being talked about a few months ago...*Edit: 2006-12-11: For anybody who happens on this topic without finding my other one, I did discover how to close TrayTips.Check this topic here. Edited December 11, 2006 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Confuzzled Posted August 10, 2006 Share Posted August 10, 2006 On the first question, would the control panel subroutines work? ncpa.cpl and powercfg.cpl are found in C:\WINDOWS\SYSTEM32\ on my PC (XP SP2) Link to comment Share on other sites More sharing options...
Briegel Posted August 10, 2006 Share Posted August 10, 2006 (edited) I found this script to control to the volume a few weeks ago . Maybe it helps you.CODE;by wiredbits;first run at doing a volume control for mixer;my system has two sounds cards and all went well with both#include <GUIConstants.au3>#include <MXSelectInputSrc_include.au3>;default mixer is always 0 (so far) which is last audio device installed or prefered deviced selected by user$curmixer=0CONST $MM_MIXM_CONTROL_CHANGE= 0x3D1CONST $CALLBACK_WINDOW =0x10000OpenAllMixers($mixers)If @error Then ExitGetMXWaveoutID($mixers,$curmixer,$MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT);Generated with Form Designer preview$Form1 = GUICreate("Mixer Volume", 437, 197, 270, 282)GUISetFont(10, 400, 0, "MS Sans Serif")$Group1 = GUICtrlCreateGroup("Volume", 56, 24, 313, 137)GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")$SL_WaveOut = GUICtrlCreateSlider(72, 64, 270, 29)GUICtrlCreateLabel(" Volume", 144, 43, 53, 20)GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")$LB_vol=GUICtrlCreateLabel("0", 208, 43, 50, 20)GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")$RAD_MasterVol = GUICtrlCreateRadio("Master Volume", 96, 128, 113, 17)GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")$RAD_WaveOut = GUICtrlCreateRadio("Wave Out", 248, 128, 105, 17)GUICtrlSetState(-1, $GUI_CHECKED)GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")GUICtrlCreateGroup("", -99, -99, 1, 1)GUISetState(@SW_SHOW)$dumCallback=GUICtrlCreateDummy ()Main()CloseAllMixers($mixers)ExitFunc Main()Local $mxvol,$msg,$admsg,$wo,$hmxobj,$x,$savevolumeGUIRegisterMsg ($MM_MIXM_CONTROL_CHANGE,"MyCallBack") ;cool commnad! first time plaing with it.$hmxobj=MixerOpen($curmixer,$Form1,$MM_MIXM_CONTROL_CHANGE,BitOR($CALLBACK_WINDOW,$MIXER_OBJECTF_MIXER) )$mxvol=GetSetOutVolume($mixers,$curmixer,0,0)$savevolume=$mxvolGUICtrlSetData($SL_WaveOut,BitAND($mxvol/ 0xFFFF * 100,0xffff))GUICtrlSetData($LB_vol,BitAND($mxvol/ 0xFFFF * 100,0xffff))$wo=GUICtrlRead($SL_WaveOut)While 1 $admsg = GuiGetMsg(1) $msg=$admsg[0];might be more accurate if use steps from control but this suits my needs If GUICtrlRead($SL_WaveOut)<>$wo Then $wo=GUICtrlRead($SL_WaveOut) GUICtrlSetData($LB_vol,$wo) $x=mod($wo*0xffff,100) $wo=BitAND($wo*0xffff/100,0xffff) $wo=$wo+$x GetSetOutVolume($mixers,$curmixer,$wo);this will also trigger callback routine $wo=GUICtrlRead($SL_WaveOut) EndIf Select Case $msg=$RAD_MasterVol ;could have just made two sliders for this example but i only need one. GetSetOutVolume($mixers,$curmixer,$savevolume) GetMXWaveoutID($mixers,$curmixer,$MIXERLINE_COMPONENTTYPE_DST_SPEAKERS) $savevolume=GetSetOutVolume($mixers,$curmixer,0,0) $mxvol=$savevolume GUICtrlSetData($SL_WaveOut,BitAND($mxvol/ 0xFFFF * 100,0xffff)) GUICtrlSetData($LB_vol,BitAND($mxvol/ 0xFFFF * 100,0xffff)) Case $msg=$RAD_WaveOut GetSetOutVolume($mixers,$curmixer,$savevolume) GetMXWaveoutID($mixers,$curmixer,$MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT) $savevolume=GetSetOutVolume($mixers,$curmixer,0,0) $mxvol=$savevolume GUICtrlSetData($SL_WaveOut,BitAND($mxvol/ 0xFFFF * 100,0xffff)) GUICtrlSetData($LB_vol,BitAND($mxvol/ 0xFFFF * 100,0xffff)) Case $msg=$dumCallback $x=GetSetOutVolume($mixers,$curmixer,0,0) If $x<>$mxvol Then $mxvol=$x GUICtrlSetData($SL_WaveOut,BitAND($mxvol/ 0xFFFF * 100,0xffff)) GUICtrlSetData($LB_vol,BitAND($mxvol/ 0xFFFF * 100,0xffff)) EndIf Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelectWEndGUIDelete($Form1)GetSetOutVolume($mixers,$curmixer,$savevolume)MixerClose($hmxobj)EndFuncFunc GetSetOutVolume($mixers,$index,$vol=0,$doset=1) Local $i,$x,$arraysize,$channels,$mtiemsCONST $MIXERCONTROLDETAILS_UNSIGNED_SIZEOF=4Local $mixercontroldetails=DllStructCreate( _"dword;" & _;DWORD cbStruct"dword;" & _;DWORD dwControlID"dword;" & _;DWORD cChannels;"dword;" & _;HWND hwndOwner DWORD cMultipleItems;"dword;" & _;DWORD cbDetails;"dword") ;LPVOID paDetails; If @error Then Return False$mitems=$mixers[$index][$MIX_OUTMULTIEMS]$channels=$mixers[$index][$MIX_OUTCHANNELS]$arraysize=$channelsIf $mitems Then $arraysize=$channels*$mitemsLocal $plistbool=DllStructCreate("dword["&$arraysize+1 &"]");give me one mroe than needed If @error Then Return False $hmxobj=$mixers[$index][$MIX_HMXOBJ] $mxcd=$mixercontroldetails DllStructSetData($mxcd,$cbStruct,DllStructGetSize($mxcd)) DllStructSetData($mxcd,2,$mixers[$index][$MIX_OUTCTRLID]) DllStructSetData($mxcd,3,$mixers[$index][$MIX_OUTCHANNELS]) DllStructSetData($mxcd,4,$mixers[$index][$MIX_OUTMULTIEMS]) DllStructSetData($mxcd,5,$MIXERCONTROLDETAILS_UNSIGNED_SIZEOF);cbDetails to sizeof one unsigned struct DllStructSetData($mxcd,6,DllStructGetPtr($plistbool));paDetails set ptr $ret = DLLCall("winmm.dll","long","mixerGetControlDetails","hwnd",$hmxobj,"ptr",DllStructGetPtr($mxcd),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_GETCONTROLDETAILSF_VALUE)) If @error Then Return False If $ret[0]=$MMSYSERR_NOERROR Then $x=DllStructGetData($plistbool,1,1);just return right channel For $i= 1 To $arraysize DllStructSetData($plistbool,1,$vol,$i);set left right to same value Next;i If $doset Then $ret = DLLCall("winmm.dll","long","mixerSetControlDetails","hwnd",$hmxobj,"ptr",DllStructGetPtr($mxcd),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_SETCONTROLDETAILSF_VALUE)) Return $x EndIfReturn FalseEndFuncFunc MyCallBack($hWndGUI, $MsgID, $WParam, $LParam) If $mixers[$curmixer][$MIX_OUTCTRLID]=$LParam Then GUICtrlSendToDummy($dumCallback) EndIfReturn 0;need to research what value to return:PEndFuncFunc GetMXWaveoutID(ByRef $mixers,$index,$linetype)Local $mitems,$chans,$hmxobj,$x,$ret,$lineid;local structures are nuked on exit...so i have read..LOLLocal $mixercontrol=DllStructCreate( _"dword;" & _; DWORD cbStruct;"dword;" & _; DWORD dwControlID;"dword;" & _; DWORD dwControlType; "dword;" & _; DWORD fdwControl; "dword;" & _; DWORD cMultipleItems;"char[16];" & _;szShortName[MIXER_SHORT_NAME_CHARS];"char[64];" & _;szName[MIXER_LONG_NAME_CHARS];"dword;" & _;lMinimum"dword;" & _;lMaximum"dword[4];" & _;dwReserved[4];"dword;" & _ ;cSteps"dword[5]"); DWORD dwReserved[6]; If @error Then return FalseLocal $mixerlinecontrols=DllStructCreate( _"dword;"& _; cbStruct;"dword;" & _; DWORD dwLineID;"dword;" & _; DWORD dwControlID DWORD dwControlType;"dword;" & _; DWORD cControls; "dword;" & _; DWORD cbmxctrl;"ptr"); LPMIXERCONTROL pamxctrl; If @error Then return False $hmxobj=$mixers[$index][$MIX_HMXOBJ] zeroline($mxline) $mxline[$dwLineID]=BitOR($index,0xFFFF0000) $mxline[$dwComponentType]=$linetype MixerGetLineInfo($hmxobj,$mxline,$MIXER_GETLINEINFOF_COMPONENTTYPE) $lineid=$mxline[$dwLineID] DllStructSetData($mixerlinecontrols,$cbStruct,DllStructGetSize($mixerlinecontrols)) DllStructSetData($mixerlinecontrols,2,$lineid) DllStructSetData($mixerlinecontrols,3,$MIXERCONTROL_CONTROLTYPE_VOLUME ) DllStructSetData($mixerlinecontrols,4,1) DllStructSetData($mixerlinecontrols,5,DllStructGetSize($mixercontrol)) DllStructSetData($mixerlinecontrols,6,DllStructGetPtr($mixercontrol)) $ret = DLLCall("winmm.dll","long","mixerGetLineControls","hwnd",$hmxobj,"ptr",DllStructGetPtr($mixerlinecontrols),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_GETLINECONTROLSF_ONEBYTYPE )) If $ret[0]<>$MMSYSERR_NOERROR Then Return False $chans=$mxline[$cChannels] $x=DllStructGetData($mixercontrol,4);fwControl If BitAND($x,$MIXERCONTROL_CONTROLF_UNIFORM) Then $chans=1 $mitems= 0 If BitAND($x,$MIXERCONTROL_CONTROLF_MULTIPLE) Then $mitems=DllStructGetData($mixercontrol,5) $x=DllStructGetData($mixercontrol,3);fwControl If BitAND($x,$MIXERCONTROL_CT_CLASS_FADER ) Then $mixers[$index][$MIX_OUTCHANNELS]=$chans $mixers[$index][$MIX_OUTMULTIEMS]=$mitems $mixers[$index][$MIX_OUTCTRLID]=DllStructGetData($mixercontrol,2) Return True EndIf Return FalseEndFuncFunc zeroline(ByRef $line)local $i For $i=0 To UBound($line)-1 $line[$i]=0 Next;iEndFuncFunc MixerGetLineInfo($hmxobj,ByRef $line,$flag)Local $mixerline= DllStructCreate("dword;dword;dword;dword;dword;dword;dword;dword;dword;dword;char[16];char[64];dword;dword;short;short;dword;char[32]") If @error Then SetError(1) Return False EndIfLocal $iFor $i=1 To UBound($line)-1 DllStructSetData($mixerline,$i,$line[$i])Next;iDllStructSetData($mixerline,$cbStruct,DllStructGetSize($mixerline))$ret = DLLCall("winmm.dll","long","mixerGetLineInfo","hwnd",$hmxobj,"ptr",DllStructGetPtr($mixerline),"int", $flag) If @error Then SetError(1) Return False EndIffor $i=1 To $szMPname$line[$i]=DllStructGetData($mixerline,$i)Next;iIf $ret[0]=$MMSYSERR_NOERROR Then Return TrueSetError(1)Return FalseEndFunc;On Exit: MIX_HMXOBJ set to return value from mixeropn...check for @errorFunc OpenAllMixers(ByRef $mixers)Local $i,$mxnumdevs,$hmxobj $mxnumdevs=mixerGetNumDevs() If $mxnumdevs Then ReDim $mixers[$mxnumdevs+1][$AMIX_SIZEOF] For $i=0 To $mxnumdevs-1 $hmxobj=mixerOpen($i,0,0,$MIXER_OBJECTF_MIXER) If @error Then SetError(1) Return False EndIf $mixers[$i][$MIX_HMXOBJ]=$hmxobj Next;i EndIf $mixers[0][0]=$mxnumdevsEndFunc;On ENtry: mixer id and flag(s) , if no id passed then the preffered id is used (0) ditto for flag;on exit: mixer handleFunc MixerOpen($uMxid=0,$hwnd=0,$instance=0,$fdwOpen=0)Local $x,$h_struct $h_struct=DllStructCreate("udword");since a local will be deleted on exit of function If @error Then SetError(1) Return False EndIf $ret = DLLCall("winmm.dll","long","mixerOpen","ptr",DllStructGetPtr($h_struct),"int",$uMxid,"int",$hwnd,"int",$instance,"int",$fdwOpen) If NOT @error Then If $ret[0]<>$MMSYSERR_NOERROR Then Return -1 $x=DllStructGetData($h_struct,1) Return $x EndIf SetError(1)return FalseEndFuncFunc CloseAllMixers($mixers)Local $i,$cnt $cnt=$mixers[0][0] For $i= 0 To $cnt-1 MixerClose($mixers[$i][$MIX_HMXOBJ]) Next;iEndFunc;On Entry: mixer handleFunc MixerClose($hmxobj) $ret = DLLCall("winmm.dll","long","mixerClose","long",$hmxobj)If NOT @error Then Return Truereturn FalseEndFuncFunc mixerGetNumDevs()$ret = DLLCall("winmm.dll","long","mixerGetNumDevs")If NOT @error Then Return $ret[0]SetError(1)return FalseEndFunc Edited August 10, 2006 by Briegel Link to comment Share on other sites More sharing options...
therks Posted August 11, 2006 Author Share Posted August 11, 2006 (edited) On the first question, would the control panel subroutines work? ncpa.cpl and powercfg.cpl are found in C:\WINDOWS\SYSTEM32\ on my PC (XP SP2) See, that's what I tried first, and I'm thinking that I might be able to use those with some command line options to get the windows I want. But by themselves I get different windows. ncpa.cpl gives me the Network Connections folder, and powercfg.cpl gives me this Acer ePowerManagement window. @Briegel, looks promising, any idea where the MXSelectInputSrc_include.au3 can be found? Nevermind, I found the original thread. Thanks for pointing this out for me. Edited August 11, 2006 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted October 1, 2006 Author Share Posted October 1, 2006 (edited) So, you want to know how dumb I feel? I don't know if this will work for everyone, but I found a rather simple way to make my power meter window appear. WinSetState('Power Meter', '', @SW_SHOW) Tadaa. *Edit: Not sure what will happen to non-battery operated computers. Someone care to give it a try? I'm guessing the window just doesn't exist. Edited October 1, 2006 by Saunders My AutoIt Stuff | My Github 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