Sign in to follow this  
Followers 0
Hello Me You

If specific windows close then script exit/stop

10 posts in this topic

#1 ·  Posted (edited)

For example I want to make a script that opens notepad. Then do some actions (e.g. type some text) and wait (sleep) for the window (notepad) to close. If the window (notepad) close then the script exit.

Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites



For example I want to make a script that opens notepad. Then do some actions (e.g. type some text) and wait (sleep) for the window (notepad) to close. If the window (notepad) close then the script exit.

... What have you tried ?

Look at :

Run()

Sleep()

WinWaitClose()

Exit

:whistle:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

... What have you tried ?

Look at :

Run()

Sleep()

WinWaitClose()

Exit

:whistle:

I will try to help you more:

_______________________________________________________________________________________

| say that the script is running

| (notepad is open)

| the script sends/types some text

| maybe accidentally i close notepad before the script exit

| after notepad close the script will continue sending keys

| i want the script to automatically stop/exit so it wont send keys anymore to another window

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi,

then you need to check everytime you are going to send something If WinExists

Or use ControlSend

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

then you need to check everytime you are going to send something If WinExists

Or use ControlSend

So long,

Mega

1)why do u say all the time so long, mega?

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

2)i am gonna try if win exists, can u help me use it?

should i do this?:

If winexits
then send("text")
else
exit
Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

something like this:

While 1
    ; do something here
    If NOT WinExists("Untitled -") Then ; Checks if "Untitled-" doesn't exist anymore (you can change this to any title)
        Exit ; Closes script
    EndIf
WEnd
Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

I will try to help you more:

_______________________________________________________________________________________

| say that the script is running

| (notepad is open)

| the script sends/types some text

| maybe accidentally i close notepad before the script exit

| after notepad close the script will continue sending keys

| i want the script to automatically stop/exit so it wont send keys anymore to another window

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

You are going to help me more ? :whistle:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

For pausing a script, here's a function I got from the help file:

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

You are going to help me more ? :whistle:

Yeah, because you don't speak the language of stupidity to well. They are helping you ,because you cannot get your head around the fact that they don't know how to read the help file.... explain it once explain it twice and they still, question because of lazy attitude... :) have a good day.

 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

Well I would use ControlSend, since if the windows doesnt exist, it cant be send...


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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