Leaderboard
Popular Content
Showing content with the highest reputation on 08/02/2015 in all areas
-
I had some free time and I wrote this: Run The code. Play some music on window media player and it will display a msgbox. ;Danyfirex 02/08/2015 #include <Array.au3> Opt("MustDeclareVars", 1) Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count ;~ AudioSessionState Global Const $CLSCTX_INPROC_SERVER = 0x01 Global Const $eMultimedia = 1 Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $sTagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $sTagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _ "GetMeteringChannelCount hresult(dword*);" & _ "GetChannelsPeakValues hresult(dword;float*);" & _ "QueryHardwareSupport hresult(dword*);" Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $sTagIMMDevice = _ "Activate hresult(struct*;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $sIID_IAudioSessionManager2 = "{77aa99a0-1bd6-484f-8bc7-2c654c9a9b6f}" Global Const $sTagIAudioSessionManager = "GetAudioSessionControl hresult(ptr;dword;ptr*);" & _ "GetSimpleAudioVolume hresult(ptr;dword;ptr*);" Global Const $sTagIAudioSessionManager2 = $sTagIAudioSessionManager & "GetSessionEnumerator hresult(ptr*);" & _ "RegisterSessionNotification hresult(ptr);" & _ "UnregisterSessionNotification hresult(ptr);" & _ "RegisterDuckNotification hresult(wstr;ptr);" & _ "UnregisterDuckNotification hresult(ptr)" Global Const $sIID_IAudioSessionEnumerator = "{e2f5bb11-0570-40ca-acdd-3aa01277dee8}" Global Const $sTagIAudioSessionEnumerator = "GetCount hresult(int*);GetSession hresult(int;ptr*)" Global Const $sIID_IAudioSessionControl = "{f4b1a599-7266-4319-a8ca-e70acb11e8cd}" Global Const $sTagIAudioSessionControl = "GetState hresult(int*);GetDisplayName hresult(ptr);" & _ "SetDisplayName hresult(wstr);GetIconPath hresult(ptr);" & _ "SetIconPath hresult(wstr;ptr);GetGroupingParam hresult(ptr*);" & _ "SetGroupingParam hresult(ptr;ptr);RegisterAudioSessionNotification hresult(ptr);" & _ "UnregisterAudioSessionNotification hresult(ptr);" Global Const $sIID_IAudioSessionControl2 = "{bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}" Global Const $sTagIAudioSessionControl2 = $sTagIAudioSessionControl & "GetSessionIdentifier hresult(ptr)" & _ "GetSessionInstanceIdentifier hresult(ptr);" & _ "GetProcessId hresult(dword*);IsSystemSoundsSession hresult();" & _ "SetDuckingPreferences hresult(bool);" HotKeySet("{ESC}", "Terminate") Global $bExit = False Local $pIAudioSessionEnumerator = 0 Local $oIAudioSessionEnumerator = 0 Local $pIAudioSessionManager2 = 0 Local $oIAudioSessionManager2 = 0 Local $pIAudioSessionControl2 = 0 Local $oIAudioSessionControl2 = 0 Local $pIAudioMeterInformation = 0 Local $oIAudioMeterInformation = 0 Local $pIMMDevice = 0 Local $oMMDevice = 0 Local $nSessions = 0 Local $ProcessID = 0 Local $fPeakValue = 0 Local $sProcessToDetectName = "wmplayer.exe";Check If a Process is playing something based on Peak Value > 0 MsgBox(0, "", "Play Some music on " & $sProcessToDetectName & " to be Detected", 5) Local $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTagIMMDeviceEnumerator) If Not IsObj($oMMDeviceEnumerator) Then Exit If FAILED($oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eMultimedia, $pIMMDevice)) Then Exit $oMMDevice = ObjCreateInterface($pIMMDevice, $sIID_IMMDevice, $sTagIMMDevice) If Not IsObj($oMMDevice) Then Exit If FAILED($oMMDevice.Activate(__uuidof($sIID_IAudioSessionManager2), $CLSCTX_INPROC_SERVER, 0, $pIAudioSessionManager2)) Then Exit $oIAudioSessionManager2 = ObjCreateInterface($pIAudioSessionManager2, $sIID_IAudioSessionManager2, $sTagIAudioSessionManager2) If Not IsObj($oIAudioSessionManager2) Then Exit While Not $bExit If FAILED($oIAudioSessionManager2.GetSessionEnumerator($pIAudioSessionEnumerator)) Then ContinueLoop $oIAudioSessionEnumerator = ObjCreateInterface($pIAudioSessionEnumerator, $sIID_IAudioSessionEnumerator, $sTagIAudioSessionEnumerator) If Not IsObj($oIAudioSessionEnumerator) Then ContinueLoop If FAILED($oIAudioSessionEnumerator.GetCount($nSessions)) Then ContinueLoop For $i = 0 To $nSessions - 1 if SUCCEEDED($oIAudioSessionEnumerator.GetSession($i, $pIAudioSessionControl2)) Then $oIAudioSessionControl2 = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioSessionControl2, $sTagIAudioSessionControl2) if @error Then ContinueLoop $oIAudioSessionControl2.GetProcessId($ProcessID) If $ProcessID = ProcessExists($sProcessToDetectName) Then $oIAudioMeterInformation = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioMeterInformation, $sTagIAudioMeterInformation) if @error Then ContinueLoop $oIAudioSessionControl2.AddRef() ;stabilize $oIAudioMeterInformation.GetPeakValue($fPeakValue) If $fPeakValue > 0 Then MsgBox(0, $sProcessToDetectName, "Sound Played Detected on " & $sProcessToDetectName & @CRLF & "Bye :)") Exit EndIf EndIf $ProcessID = 0 $oIAudioMeterInformation = 0 ;Free $oIAudioSessionControl2 = 0 ;Free EndIf Next $oIAudioSessionEnumerator=0 Sleep(30) WEnd Func FAILED($hr) Return ($hr < 0) EndFunc ;==>FAILED Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Func Terminate() $bExit = True EndFunc ;==>Terminate Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Func CLSIDFromString($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) Return $tGUID EndFunc ;==>CLSIDFromString Saludos1 point
-
The variable being global is beside the point, the value being printed is a return from a function that returns nothing.1 point
-
I think Scintella is excellently documented for example over here http://www.scintilla.org/ScintillaDoc.html So if you learn in AutoIT how to do sendmessage stuff its not very difficult and scite.udf can indeed be a teacherdocument see also source of ISN AutoIT studio http://www.isnetwork.at/index.php/2011-10-17-08-51-431 point
-
No. Go to the AutoIt download page on the main site and then find the link to the beta directory. The Zip file has docs in the name.1 point
-
Chimp, Perhaps this? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $ahChild[1][2] = [[0, False]], $SC_MOVE = 0xF010 $hGUI = GUICreate("Parent Window", 633, 447, 192, 200) GUICtrlCreateLabel("", 0, 0, 0, 0) $mMain = GUICtrlCreateMenu("New") $mChild = GUICtrlCreateMenuItem("Child", $mMain) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SYSCOMMAND, "_WM_SYSCOMMAND") While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI ; Main GUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $mChild $hChild = _CreateMDIChild($hGUI) EndSwitch Case Else $hChild = _CheckMDIChildren($aMsg) EndSwitch WEnd Func _CreateMDIChild($hParent) ; Create child Local $hChild = GUICreate("Child " & $ahChild[0][0] + 1, 300, 300, 10, 0, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) ; Set parent _WinAPI_SetParent($hChild, $hParent) ; Increase counter $ahChild[0][0] += 1 ; Increase array size ReDim $ahChild[$ahChild[0][0] + 1][2] ; Set values $ahChild[$ahChild[0][0]][0] = $hChild $ahChild[$ahChild[0][0]][1] = False ; Show child GUISetState() Return $hChild EndFunc ;==>CreateChild Func _CheckMDIChildren($aMsg) Local $fRet = False For $i = 1 To $ahChild[0][0] If $aMsg[1] = $ahChild[$i][0] Then Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($ahChild[$i][0]) $ahChild[$i][1] = False Case $GUI_EVENT_MAXIMIZE $ahChild[$i][1] = True $ahChild[0][1] = True Case $GUI_EVENT_RESTORE $ahChild[$i][1] = False $ahChild[0][1] = False EndSwitch $fRet = True EndIf Next Return $fRet EndFunc Func _WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) If $ahChild[0][1] = True Then For $i = 1 To $ahChild[0][0] If $ahChild[$i][1] Then If $hWnd = $ahChild[$i][0] Then If BitAND($wParam, 0xFFF0) = $SC_MOVE Then Return False ExitLoop EndIf EndIf Next EndIf Return $GUI_RUNDEFMSG EndFunc ;==>On_WM_SYSCOMMANDThe WM_SYSCOMMAND handler just prevents the maximized child being moved. M231 point
-
? #include <WindowsConstants.au3> $hGUI = GUICreate('Main GUI', 300, 300, 300) $hGUI_Child = GUICreate('#2', 150, 100,100,100,BitOr($WS_CHILD,$WS_BORDER),-1,$hGUI) GUISetBkColor(0xffffff) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_Child) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") MsgBox(0,0,"Pause") Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $hGUI_Child) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION EndFunc1 point
-
GUIRegisterMsg ( $WM_MOVE, "_WM_MOVE" ) Check position of child If it is at a boundary of parent, move it back.1 point
-
automaterk, This script based on MSAA-code prints information in SciTE console about all elements it can find in a window. You have to add a line in top of script to get window handle. Let's see whether the code can find the listbox elements. #include "CUIAutomation2.au3" #include "MSAccessibility.au3" Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Get window handle ;Local $hWindow = WinGetHandle( "[CLASS:Chrome_WidgetWin_1]", "" ) ; Chrome ; http://tweepi.com/auth/login ;Local $hWindow = WinGetHandle( "[CLASS:MozillaWindowClass]", "" ) ; Mozilla Firefox ;Local $hWindow = WinGetHandle( "[CLASS:IEFrame]" ) ; Internet Explorer ;Local $hWindow = WinGetHandle( "[CLASS:CabinetWClass]" ) ; Windows Explorer, Vista, 7, 8 ;Local $hWindow = WinGetHandle( "[CLASS:ExploreWClass]" ) ; Windows Explorer, Windows XP Local $hWindow = WinGetHandle( "Calculator" ) ; Calculator ;Local $hWindow = ControlGetHandle("[CLASS:Notepad]", "", "Edit1") ; Notepad ;Local $hWindow = 0x000403DA ; Chrome ; http://tweepi.com/auth/login If Not $hWindow Then Return ConsoleWrite( "Window handle ERR" & @CRLF ) ConsoleWrite( "Window handle OK" & @CRLF ) ; Get Window object Local $pWindow, $oWindow AccessibleObjectFromWindow( $hWindow, $OBJID_CLIENT, $tIID_IAccessible, $pWindow ) $oWindow = ObjCreateInterface( $pWindow, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oWindow ) Then Return ConsoleWrite( "Window object ERR" & @CRLF ) ConsoleWrite( "Window object OK" & @CRLF ) ; Window name Local $sName ConsoleWrite( @CRLF & "Window:" ) ConsoleWrite( @CRLF & "-------" & @CRLF ) PrintElementInfo( $oWindow, $CHILDID_SELF, "" ) ; Get children ConsoleWrite( "Children:" & @CRLF ) ConsoleWrite( "---------" & @CRLF ) WalkTreeWithAccessibleChildren( $pWindow, 0 ) EndFunc Func WalkTreeWithAccessibleChildren( $pAcc, $iLevel, $iLevels = 0 ) If $iLevels And $iLevel = $iLevels Then Return ; Create object Local $oAcc = ObjCreateInterface( $pAcc, $sIID_IAccessible, $dtagIAccessible ) If Not IsObj( $oAcc ) Then Return $oAcc.AddRef() Local $iChildCount, $iReturnCount, $tVarChildren ; Get children If $oAcc.get_accChildCount( $iChildCount ) Or Not $iChildCount Then Return If AccessibleChildren( $pAcc, 0, $iChildCount, $tVarChildren, $iReturnCount ) Then Return ; Indentation Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next Local $hWnd WindowFromAccessibleObject( $pAcc, $hWnd ) ConsoleWrite( $sIndent & "Window = " & $hWnd & @CRLF & @CRLF ) Local $vt, $pChildObj, $oChildObj, $iChildElem ; For each child For $i = 1 To $iReturnCount ; $tVarChildren is an array of VARIANTs with information about the children $vt = BitAND( DllStructGetData( $tVarChildren, $i, 1 ), 0xFFFF ) If $vt = $VT_DISPATCH Then ; Child object $pChildObj = DllStructGetData( $tVarChildren, $i, 3 ) $oChildObj = ObjCreateInterface( $pChildObj, $sIID_IAccessible, $dtagIAccessible ) If IsObj( $oChildObj ) Then PrintElementInfo( $oChildObj, $CHILDID_SELF, $sIndent ) WalkTreeWithAccessibleChildren( $pChildObj, $iLevel + 1, $iLevels ) EndIf Else ; $vt = $VT_I4 ; Child element $iChildElem = DllStructGetData( $tVarChildren, $i, 3 ) PrintElementInfo( $oAcc, $iChildElem, $sIndent ) EndIf Next EndFunc You need CUIAutomation2.au3 and MSAccessibility.au3. If you get errors on double-defined constants, comment out the constants in MSAccessibility.au3.1 point
-
It's not so difficult to use, look at post #9 here >> https://www.autoitscript.com/forum/topic/155563-move-to-another-line-in-scite/ #include '_SciTE.au3' _SciTE_Startup() ConsoleWrite(_SciTE_GetCurrentFile()) _SciTE_Shutdown()OR download the help file sources in the AutoIt beta directory and find SciTELib.au3. That's a different variation of the library I wrote for building the help docs.1 point
-
In that case why do you specify : "$sFileLnk parameter must be Link(.lnk) to our program."1 point
-
Exactly what Jos said. This was designed only for me and not for public use. Anyway, I have made it as simple as possible.1 point
-
1 point
-
CodeCrypter - Encrypt your Script
VenusProject2 reacted to RTFC for a topic
So far, the ants are winning, so to vent my frustration I fixed the veryveryverylongstring-issue that still plagued MCF.au3, as identified by souldjer777 (many thanks for identifying it; I'm kinda surprised no-one stumbled on this before). It was indeed a trivial mistake, and trivial to fix. I've updated the CodeScannerCrypter bundle (still version 1.4), so please download it again if you did earlier. Now back to this manual I'm reading: Tactical nuclear warfare against household pests For Dummies, chapter 23...1 point -
Mbee, I seem to remember that I coded the flag as "0 + 16" in the examples just to make the point that using the "16" option will only work if you use the "0" option as the basic display. If you use one of the other basic options (1-3) then it has no effect - as described in the function header: ; 0 - Entire folder tree and all matching files within folders - only files can be selected ; 1 - All matching files within the specified folder - subfolders are not displayed ; 2 - Entire folder tree only - no files. Doubleclicks will expand, not select, item ; 3 - As 2 but doubleclicks will select item if it has no children [...] ; + 16 - Both files and folders selectable if basic $iDisplay set to 0 - folders have trailing \If you set the basic display to 1 (files only) or 2/3 (folders only) then adding a flag which allows both files and folders to be selected when only one of them is displayed is of little use. As to the main question: you need to register at least the WM_NOTIFY handler as the UDF uses it to expand the tree when you click on a node. Once again, this is explained in the function header: Registers WM_NOTIFY for TreeView doubleclick and item expansion and WM_COMMAND for list focusSo you would need to use: _CFF_RegMsg(True, False) $L_Ret = _CFF_Choose($Cmy_Title, 300, 500, -1, -1, "", Default, 2 + 4 + 8 + 32, -1)Now you will be able to expand the tree - there is no need for the "16" because, as explained above, you are only displaying folders so it is ignored. All clear now? M231 point