Sign in to follow this  
Followers 0
meamrussian

Help Out With Simple Code

6 posts in this topic

Here's the code:

Func this()
Do

    Send ("{tab}")
    Send ("{enter}")
    Sleep (23000)
    Send ("{ALT} + {F4}")
    $x = 0
    $x = $x + 1

Until $x = 50
Endfunc

HotKeySet ("{pause}", "this")

While 1
Wend
This is for a browser. When it presses enter, it opens a new window and waits. Then, I want it to close the window and go to the next link. However, the window just doesn't want to close :P What am I doing wrong? I would do WinClose ("Firefox"), but there is always more than one firefox window open. How do I close that top window to go back to the original?

Also, what's the code to press pause again (or another key) to stop the script?

Thanks a bunch.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Also, what's the code to press pause again (or another key) to stop the script?

To be honest, thats the part i only understand.

Anyway:

Func this()
$stop = 0
Do

    Send ("{tab}")
    Send ("{enter}")
    Sleep (23000)
    Send ("{ALT} + {F4}")
    $x = 0
    $x = $x + 1

Until $x = 50

Endfunc

HotKeySet ("{pause}", "this")
hotkeyset("{INS}","pause")

Func pause()
if $stop = 0 Then
$stop = 1
Else
$stop = 0
Endif
EndFunc

While 1
Wend

Pressing Insert will pause the script

Also, if you want to make it pause on 1 key only then use

Func something();;Where something is your func
$stop = NOT $stop
While $stop
;;do stuff here
WEnd
EndFunc
Edited by NegativeNrG

[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

Send ("{ALT} + {F4}") = Send("!{F4}")


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Here's the code:

Func this()
Do

    Send ("{tab}")
    Send ("{enter}")
    Sleep (23000)
    Send ("{ALT} + {F4}")
    $x = 0
    $x = $x + 1

Until $x = 50
Endfunc

HotKeySet ("{pause}", "this")
I didn't look past Send ("{ALT} + {F4}") till just now...

In your loop you have:

$x = 0 << put this before the loop.

$x = x + 1

Until $x = 50 << $x will never = anything but 0 and 1

Func this()
Local $x = ''
Do

    Send ("{tab}")
    Send ("{enter}")
    Sleep (23000)
    Send ("!{F4}")
    $x = $x + 1

Until $x = 50
Endfunc
Try that

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Send ("{ALT} + {F4}") = Send("!{F4}")

actually i think

Send ("{ALT} + {F4}") = Send("{ALT}{SPACE}{LSHIFT DOWN}{SPACE}{LSHIFT UP}{F4}")


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Another way of instructing the active window to close:

WinClose('')

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