Jump to content

How to check command prompt window exists or not?


afsar
 Share

Recommended Posts

hi to all,

when i am installing our company software automatically a command promt window also occurs while installing.

how can i know by script that command prompt windows exixts or not.

i tried with

if processexists("cmd.exe") then

msgbox(4096,"windows existence"," window exists")

bla bla bla

endif

but i didnt get any messagebox even the command prompt window is active

thanks for help in advance

Afsar

Link to comment
Share on other sites

You could try

If WinExists("Command Prompt") Then
    MsgBox(0, "", "Window exists")
EndIf

BTW

This is straight from the help files.

:whistle::dance::dance:


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

You could try

If WinExists("Command Prompt") Then
    MsgBox(0, "", "Window exists")
EndIf

BTW

This is straight from the help files.

:whistle:  :dance:  :dance:

<{POST_SNAPBACK}>

if the command prompt window name is like..C:\wINDOWs\Microsoft.Net\..... then also can i use as winexists("command Prompt") ?
Link to comment
Share on other sites

if the command prompt window name is like..C:\wINDOWs\Microsoft.Net\..... then also can i use as winexists("command Prompt") ?

<{POST_SNAPBACK}>

Change the words "Command Prompt" to whatever the window is called. If you are not sure of the window name use "Autiit Window Info"


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Change the words "Command Prompt" to whatever the window is called. If you are not sure of the window name use "Autiit Window Info"

<{POST_SNAPBACK}>

ya i tried with that but the command prompt window with the same window name which has hidden property then also showing the messagebox.

and the hidden command prompt windows exists through the end of setup.

Is there any possible to display messagebox only for active display windows and not for active hidden windows

Link to comment
Share on other sites

ya i tried with that but the command prompt window with the same window name which has hidden property then also showing the messagebox.

and the hidden command prompt windows exists through the end of setup.

Is there any possible to display messagebox only for active display windows and not for active hidden windows

<{POST_SNAPBACK}>

Sorry but you have lost me, I have no idea what you are trying to do.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Sorry but you have lost me, I have no idea what you are trying to do.

<{POST_SNAPBACK}>

OK,

i am using wingettitle for windows title like..

$WinTitle = WinGetTitle( '', '' )

if StringInStr ( $WinTitle, 'InstallShield Wizard') > 0 then

CheckWinText ( )

endif

if StringInStr ( $WinTitle, 'C:\WINDOWS\Microsoft.NET\') > 0 then

CheckWinText ( )

endif

Func checkwintext()

if winactive($WinTitle,'Preparing to Install...')

send('{ENTER}')

endif

if winactive($WinTitle,'')

; becos we cant read command prompt text and we cant give the text

msgbox(0,"","Window Exists")

endif

endfunc

but the problem is this wingettitle returns a string for hidden windows also.

i need a window title for only active windows..

hope u get an idea now..

Link to comment
Share on other sites

Could you not use something like WinWaitActive for your installation program rather than searching all active windows for title.

EDIT

Code added

If WinWaitActive("Window Title") Then
                 Send("{ENTER}")
     EndIf
Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Could you not use something like WinWaitActive for your installation program rather than searching all active windows for title.

EDIT

Code added

If WinWaitActive("Window Title") Then
                 Send("{ENTER}")
     EndIf

<{POST_SNAPBACK}>

i cant use like that cos i am testing the software for errors..

so i have to search all the window titles and compare it..

i am using 1 script for 3 installations..

so i must search for titles..

Link to comment
Share on other sites

I'll bet there is a better way, but you could determine if the window you're after is hidden or not:

"WinGetPos returns negative numbers such as -32000 for minimized windows, but works fine with (non-minimized) hidden windows.

If the window title "Program Manager" is used, the function will return the size of the desktop. If multiple windows match the criteria, the most recently active window is used."

--from help file.

J

If I am too verbose, just say so. You don't need to run on and on.

Link to comment
Share on other sites

I think that this is beyond my limited knowledge so I will have to leave it and hope that someone else picks it up.

Sorry :"> :"> :">


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

I'll bet there is a better way, but you could determine if the window you're after is hidden or not:

"WinGetPos returns negative numbers such as -32000 for minimized windows, but works fine with (non-minimized) hidden windows.

If the window title "Program Manager" is used, the function will return the size of the desktop. If multiple windows match the criteria, the most recently active window is used."

--from help file.

J

<{POST_SNAPBACK}>

in my installation the window C:\WINDOWS\Microsoft is almost active but hidden till the end of setup. but only twice it is active and display the window as command prompt with title C:\Windows\Microsoft...

can u tell me how to find thw window is hidden or not...

my be i can use this b4 enetering into the function

Link to comment
Share on other sites

opt("winTitleMatchMode", 4)
if winActive("classname=ConsoleWindowClass") then
    msgBox(0x40040, "AutoIt", "Window exists.")
; (other commands)
endIf

Does this do what you want?

Link to comment
Share on other sites

My above post was in relation to determining if a console window is active. To determine if it is hidden:

opt("winTitleMatchMode", 4)
if not(bitAND(winGetState("classname=ConsoleWindowClass"), 2)) then
    msgBox(0x40040, "AutoIt", "Window exists but is not visible.")
; (other commands)
endIf
Edited by LxP
Link to comment
Share on other sites

My above post was in relation to determining if a console window is active. To determine if it is hidden:

opt("winTitleMatchMode", 4)
if not(bitAND(winGetState("classname=ConsoleWindowClass"), 2)) then
    msgBox(0x40040, "AutoIt", "Window exists but is not visible.")
; (other commands)
endIf

<{POST_SNAPBACK}>

Thanx, i hope that helps me..

i try it on next week again in Company..

i will update u soon

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...