Jump to content

How to loop?


Recommended Posts

Run("vExplorer.exe");Runs "Explorer.exe"
Sleep(5000);Waits 5 Seconds
Send("{TAB}");Tabs to Title
Send("Bump");Types Bump in Title
Send("{TAB}");Tabs to Message
Send("Bump");Types Bump in Message
Send("{TAB 72} {ENTER}");Tabs to Submit
Sleep("35000");Waits 35 Seconds
Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
Sleep(5000);Waits 5 Seconds
Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
Sleep(5000);Waits 5 Seconds
ProcessClose("vExplorer.exe");Kills vExplorer.exe
Exit

Ok, heres my code, finnaly finnished, it was longer, before it was meant to vote in a poll before it deleted the topic, but everytime it remade the topic, i kept getting an error saying that the poll had all ready been voted in... so i took out that part of code... Anyway, not the question.

So, thats my code, can you believe it took me a day to make... sad... Anyway its my 2nd ive made.

Heres my question, How do i make it loop a certain ammount of times?

e.g, so itll loop just after the explorer gets killed, so it opens again.

I read the help file. but i didnt really understand how to use it still, so i came here.

- AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

I think this should work.

$i = 0
$toggle = 0

While 1
    If $i = 5 Then Quit()
    If $toggle =1 Then
        Do
            Stuff()
            $i = $i + 1
        Until $toggle = 0
    EndIf
WEnd


    
Func Stuff()
    Run("vExplorer.exe");Runs "Explorer.exe"
    Sleep(5000);Waits 5 Seconds
    Send("{TAB}");Tabs to Title
    Send("Bump");Types Bump in Title
    Send("{TAB}");Tabs to Message
    Send("Bump");Types Bump in Message
    Send("{TAB 72} {ENTER}");Tabs to Submit
    Sleep("35000");Waits 35 Seconds
    Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
    Sleep(5000);Waits 5 Seconds
    Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
    Sleep(5000);Waits 5 Seconds
    ProcessClose("vExplorer.exe");Kills vExplorer.exe
EndFunc

Func Quit()
    Exit
EndFunc
Link to comment
Share on other sites

I think this should work.

$i = 0
$toggle = 0

While 1
    If $i = 5 Then Quit()
    If $toggle =1 Then
        Do
            Stuff()
            $i = $i + 1
        Until $toggle = 0
    EndIf
WEnd
    
Func Stuff()
    Run("vExplorer.exe");Runs "Explorer.exe"
    Sleep(5000);Waits 5 Seconds
    Send("{TAB}");Tabs to Title
    Send("Bump");Types Bump in Title
    Send("{TAB}");Tabs to Message
    Send("Bump");Types Bump in Message
    Send("{TAB 72} {ENTER}");Tabs to Submit
    Sleep("35000");Waits 35 Seconds
    Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
    Sleep(5000);Waits 5 Seconds
    Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
    Sleep(5000);Waits 5 Seconds
    ProcessClose("vExplorer.exe");Kills vExplorer.exe
EndFunc

Func Quit()
    Exit
EndFunc
Hmm, when i run it, nothing happens, it says its running, but the yeh...
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Ok, heres my code, finnaly finnished, it was longer, before it was meant to vote in a poll before it deleted the topic, but everytime it remade the topic, i kept getting an error saying that the poll had all ready been voted in... so i took out that part of code... Anyway, not the question.

So, thats my code, can you believe it took me a day to make... sad... Anyway its my 2nd ive made.

Heres my question, How do i make it loop a certain ammount of times?

e.g, so itll loop just after the explorer gets killed, so it opens again.

I read the help file. but i didnt really understand how to use it still, so i came here.

- AzKay

Another way (Much Easier I think)

Dim $i=0
$number= Inputbox("How Much?", "Input your number here")
If Int($number) then
While $i< $number
Run("vExplorer.exe");Runs "Explorer.exe"
Sleep(5000);Waits 5 Seconds
Send("{TAB}");Tabs to Title
Send("Bump");Types Bump in Title
Send("{TAB}");Tabs to Message
Send("Bump");Types Bump in Message
Send("{TAB 72} {ENTER}");Tabs to Submit
Sleep("35000");Waits 35 Seconds
Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
Sleep(5000);Waits 5 Seconds
Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
Sleep(5000);Waits 5 Seconds
ProcessClose("vExplorer.exe");Kills vExplorer.exe
$i = $i+1
Wend
Else
Msgbox(0, "Number", "You MUST enter a Number"
Endif
Link to comment
Share on other sites

  • Moderators

That's because toggle() never = 1 and $i never = 5 the way it is set up, so it never reaches the Do loop.

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.

Link to comment
Share on other sites

Another way (Much Easier I think)

Dim $i=0
$number= Inputbox("How Much?", "Input your number here")
If Int($number) then
While $i< $number
Run("vExplorer.exe");Runs "Explorer.exe"
Sleep(5000);Waits 5 Seconds
Send("{TAB}");Tabs to Title
Send("Bump");Types Bump in Title
Send("{TAB}");Tabs to Message
Send("Bump");Types Bump in Message
Send("{TAB 72} {ENTER}");Tabs to Submit
Sleep("35000");Waits 35 Seconds
Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
Sleep(5000);Waits 5 Seconds
Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
Sleep(5000);Waits 5 Seconds
ProcessClose("vExplorer.exe");Kills vExplorer.exe
$i = $i+1
Wend
Else
Msgbox(0, "Number", "You MUST enter a Number"
Endif
Thanks this works ^^

One very very very very last question, is their a way to make it work in the background? so you can do other things while its running?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

One very very very very last question, is their a way to make it work in the background? so you can do other things while its running?

The only way you could do this without having the window active is if you found a way to bump your post other than do it manually, because autoit actually uses your keyboard commands/mouse movements to do what you want, so to do it in the background would require SERIOUS Tweeking on the actual sleep/send aspect of the script

Link to comment
Share on other sites

  • Moderators

Use ControlSend() instead of Send(), ControlSend() doesn't need the window active to send information to it.

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.

Link to comment
Share on other sites

use controlsend tuh duh

EDIT: smoke gosh dangit posted at the same time i was trying to beat you

Thanks muchly ^^
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

This'll work. I thought I'd leave the toggle and everything up to him, I didn't know he wanted it all done, just how to loop it. I do like yours better Paulie.

$i = 0
$toggle = 0

HotKeySet("left", "Toggle")

While 1
    If $i = 5 Then Quit()
    If $toggle =1 Then
        Do
            Stuff()
        Until $toggle = 0
    EndIf
WEnd

Func Toggle ()
    If $toggle = 0 Then
        $toggle =1
    Else
        $toggle = 0
    EndIf
EndFunc
   
Func Stuff()
    Run("vExplorer.exe");Runs "Explorer.exe"
    Sleep(5000);Waits 5 Seconds
    Send("{TAB}");Tabs to Title
    Send("Bump");Types Bump in Title
    Send("{TAB}");Tabs to Message
    Send("Bump");Types Bump in Message
    Send("{TAB 72} {ENTER}");Tabs to Submit
    Sleep("35000");Waits 35 Seconds
    Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
    Sleep(5000);Waits 5 Seconds
    Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
    Sleep(5000);Waits 5 Seconds
    ProcessClose("vExplorer.exe");Kills vExplorer.exe
    $i = $i + 1
EndFunc

Func Quit()
    Exit
EndFunc
Link to comment
Share on other sites

I know i said no more questions, but i have one more, when i use the info box, to find the control ID, it doesnt show anything.. Is this where the IE.au3 comes in? do i need to use that?

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Moderators

@gamepin -

HotKeySet('left', 'toggle')
Isn't going to work, if you are trying to use the arrow keys try this instead
HotKeySet('{left}', 'test')

While 1
    Sleep(10000)
WEnd

Func test()
    MsgBox(0, 'Made', 'It here')
EndFunc

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.

Link to comment
Share on other sites

I know i said no more questions, but i have one more, when i use the info box, to find the control ID, it doesnt show anything.. Is this where the IE.au3 comes in? do i need to use that?

oh and, everyones been telling me to use it, with stuff, but the thing is, i have no idea how im supposed to use it ^^;
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Moderators

oh and, everyones been telling me to use it, with stuff, but the thing is, i have no idea how im supposed to use it ^^;

IE.au3 Library

IE.au3 Help File

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.

Link to comment
Share on other sites

  • Moderators

Yes, i know im being very annoying, but, i went through the help file, and all, and i still dont understand, any hints? clues?

On what? The general rule of thumb here, is if your having an issue using something, and it is not working, give a description of what your trying to do, along with the code you've tried to do it with that is not working.

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.

Link to comment
Share on other sites

On what? The general rule of thumb here, is if your having an issue using something, and it is not working, give a description of what your trying to do, along with the code you've tried to do it with that is not working.

Ok, my code

Dim $i=0
$number= Inputbox("How Much?", "Input your number here")
If Int($number) then
While $i< $number
Run("vExplorer.exe");Runs "Explorer.exe"
Sleep(5000);Waits 5 Seconds
Send("{TAB}");Tabs to Title
Send("Bump");Types Bump in Title
Send("{TAB}");Tabs to Message
Send("Bump");Types Bump in Message
Send("{TAB 72} {ENTER}");Tabs to Submit
Sleep("35000");Waits 35 Seconds
Send("{TAB 28} {ENTER}");Tabs to Delete Topic & Presses Enter
Sleep(5000);Waits 5 Seconds
Send("{TAB 15} {ENTER}");Tabs to Delete This Topic!
Sleep(50000);Waits 50 Seconds
ProcessClose("vExplorer.exe");Kills vExplorer.exe
$i = $i+1
Wend
Else
Msgbox(0, "Number", "You MUST enter a Number")
Endif

The page is like this

http://i4.tinypic.com/10qxlb6.jpg

I am trying to made the code work in the background, the help file says

ControlSend ( "title", "text", controlID, "string" [, flag] )

title The title of the window to access. 
text The text of the window to access. 
controlID The control to interact with. See Controls. 
string String of characters to send to the control. 
flag [optional] Changes how "keys" is processed:
  flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.
  flag = 1, keys are sent raw. 


Return Value

Success: Returns 1. 
Failure: Returns 0 if window/control is not found. 

 

Remarks

ControlSend works in a similar way to Send but it can send key strokes directly to a window, rather than just to the active window.


 

Related

ControlCommand, Send 
 

Example


ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window")

It says i need the the Control ID the text and the window title, the only one i have is the window title, i dont understand what they mean by the text, and i cant find the control id.

So basically, i want my program to run in the background using ControlSend.

How will i do this?

- AzKay

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

oops had a lil error in the last one here try this , it will log you in to autoit just change the username and pass

#include <IE.au3>

$IE = _IEcreate("http://www.autoitscript.com/forum/index.php?act=Login&CODE=00",0,1)
_IELoadWait($IE)
$form = _IEFormGetObjByName($IE,"LOGIN")
$Username = _IEFormElementGetObjByName($form,"UserName")
$Password = _IEFormElementGetObjByName($form,"PassWord")
_IEFormElementSetValue($Username,"YOUR USERNAME HERE")
_IEFormElementSetValue($Password,"YOUR PASSWORD HERE")
_IEFormSubmit($form)
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...