Sign in to follow this  
Followers 0
gil900

how can i detect if i am in full screen of some program?

16 posts in this topic

#1 ·  Posted (edited)

Hello.

i worte some good script with amazing idea for myself and all of it do the job Perfectly.

but it is is required that this specific job will not execute whan i for example playing movie or listen to music.

so i have to do a condition that checks if i am not do such things.

i know that i can program that it will look in to ini file ot txt file which contains a list of programs that when they runing so the job will not execute but i wondering if there is a better way that the script will know alone when to do the job and when not.

thanks for the helpers!

Edited by gil900

Share this post


Link to post
Share on other sites



gil900,

I seem to remember that the last time this was asked the solution was to look at the size of the active window and compare it to the screen size - something like this:

$aWin_Pos = WinGetPos("[ACTIVE]")

If $aWin_Pos[3] = @DesktopWidth And $aWin_Pos[3] = @DesktopHeight Then
    MsgBox(0, "Result", "FullScreen")
Else
    MsgBox(0, "Result", "Windowed")
EndIf

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

gil900,

I seem to remember that the last time this was asked the solution was to look at the size of the active window and compare it to the screen size - something like this:

$aWin_Pos = WinGetPos("[ACTIVE]")

If $aWin_Pos[3] = @DesktopWidth And $aWin_Pos[3] = @DesktopHeight Then
    MsgBox(0, "Result", "FullScreen")
Else
    MsgBox(0, "Result", "Windowed")
EndIf

M23

thanks,

good idea or maybe not?

if the active widow is firefox or some window? so its size will never can be the screen size..

it will really work?

EDIT:

OK my mistake.

i got the idea

and what about music or sound?

how it can i recognize if there is sound from the computer?

Edited by gil900

Share this post


Link to post
Share on other sites

gil900,

You spoke of music or movies - which do run fullcreen - not browsers - which can be maximized. If you want to look to see if a window is maximized rather than actually fullscreen then you can just look for the maximized attribute like this:

If BitAND(WinGetState("[ACTIVE]"), 32) Then
    MsgBox(0, "Result", "Maximized")
Else
    MsgBox(0, "Result", "Not maximized")
EndIf

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

OK i got the idea about the fullscreen!

thanks you!

now i want to know if there is a way to recognize sound froum the Audio Device.

because the case of sound cover all other cases when the job should not execute

Edited by gil900

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Update:

i found here:

a small program with something i need..

so i changed the code to this:

#include <BassEnc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>

Opt("GUIOnEventMode", 1)

Global $device, $input, $EncHandle, $RecHandle, $Bitrate = 128, $KHZ = 44100, $levels, $levelL = 0, $levelR = 0, $temp, $EncState = False

$bass_dll = DllOpen("BASS.dll")
$bassenc_dll = DllOpen("BASSENC.dll")
$basscb_dll = DllOpen("BASSCB.dll")


;_BASS_SetConfig($bass_dll, $BASS_CONFIG_REC_BUFFER, 1000)
$device = _GetDevices()
$test = _BASS_RecordInit($bass_dll, $device)
 $RecHandle = _BASS_RecordStart(44100, 2, 0, $BASS_EXT_RecordProc)

$timer = TimerInit()
While 1
    Sleep(20)
    $peak = _BASS_ChannelGetLevel($bass_dll,$RecHandle)
    ToolTip( $peak)
WEnd





Func _GetDevices()
    Local $count = 0, $info, $name = "", $sdef = "", $idef = 0
    While 1
        $info = _BASS_RecordGetDeviceInfo($bass_dll, $count)
        If @error Then ExitLoop
        $count += 1
        If BitAND($info[2], $BASS_DEVICE_ENABLED) Then $name &= $info[0] & "|"
        If BitAND($info[2], $BASS_DEVICE_DEFAULT) Then
            $sdef = $info[0]
            $idef = $count
        EndIf
    WEnd
    Return $idef - 1
EndFunc



Func _Exit()
    If _BASS_Encode_IsActive($bass_dll, $bassenc_dll, $EncHandle) Then _BASS_Encode_Stop($bass_dll, $bassenc_dll, $EncHandle)
    _BASS_RecordFree($bass_dll)
    Exit
EndFunc

the only thing that i need is the $peak variable.

i still didn't ccleened the code perfectly but i will do this aftar i will get what i want..

the only problam is that the $peak variable give the number of the sound that out frome the microphone and not from the Speakers.

i just need that it will give it from the Speakers...

how to do this?

Edited by gil900

Share this post


Link to post
Share on other sites

gil900,

I suggest you start a new thread - no-one is going to read this far down to find a new question and I have no idea. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

gil900,

I seem to remember that the last time this was asked the solution was to look at the size of the active window and compare it to the screen size - something like this:

$aWin_Pos = WinGetPos("[ACTIVE]")

If $aWin_Pos[3] = @DesktopWidth And $aWin_Pos[3] = @DesktopHeight Then
    MsgBox(0, "Result", "FullScreen")
Else
    MsgBox(0, "Result", "Windowed")
EndIf

M23

I checked it now.

It does not work on anything ..

I tried XBMC, VLC and Firefox. It does not recognize the full screen.

This is what I tried (I did a minor change to test it)

While 1
Sleep(200)
$aWin_Pos = WinGetPos("[ACTIVE]")

If $aWin_Pos[3] = @DesktopWidth And $aWin_Pos[3] = @DesktopHeight Then
ToolTip("FullScreen")
Else
ToolTip("Windowed")
EndIf
WEnd
Edited by gil900

Share this post


Link to post
Share on other sites

gil900,

Are you maximizing these windows using the button at top right so that the title bar is still visible - or are you actually going "full screen" so nothing else is visible (as you can with a DVD player)? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

gil900,

Are you maximizing these windows using the button at top right so that the title bar is still visible - or are you actually going "full screen" so nothing else is visible (as you can with a DVD player)? :huh:

M23

i actually going "full screen" so nothing else is visible

Share this post


Link to post
Share on other sites

gil900,

Well, the 2 snippets I posted above work for me when I run maximized or fullscreen apps, so I have no idea why they do not for you - sorry. :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Maybe the tooltip is like a window..

i will test it with ConsoleWrite()

Share this post


Link to post
Share on other sites

ok it is not the tooltip.

it just not working..

Thanks anyway

Someone else can help me?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Update:

i found your mistake in the code and i have fixed it. the red color is the mistake after i fixed it.

it was before 3

but it need one more change about when no window is active

While 1

Sleep(250)

$aWin_Pos = WinGetPos("[ACTIVE]")

If $aWin_Pos[2] = @DesktopWidth And $aWin_Pos[3] = @DesktopHeight Then

ToolTip("FullScreen")

Else

ToolTip("Windowed")

EndIf

WEnd

EDIT

and Shorter way to write this is this:

IF $aWin_Pos[2]&$aWin_Pos[3] = @DesktopWidth&@DesktopHeight Then

Edited by gil900

Share this post


Link to post
Share on other sites

gill900,

Well spotted - that is what comes of typing too fast! :thumbsup:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

gill900,

Well spotted - that is what comes of typing too fast! :thumbsup:

M23

It's okay .. We all make mistakes sometimes.

I added something necessary the code:

While 1
Sleep(250)
$aWin_Pos = WinGetPos("[ACTIVE]")
    If $aWin_Pos[2]&$aWin_Pos[3] = @DesktopWidth&@DesktopHeight And WinGetTitle("[ACTIVE]") <> "Program Manager" Then
        ToolTip("FullScreen")
    Else
        ToolTip("NO FullScreen")
    EndIf
WEnd
Edited by gil900

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0