Jump to content

Error: EndIf


 Share

Recommended Posts

Hi! I have a problem I put a EndIf statement at the end of my script and the "No EndIf Statement" Error still shows up here is my script:

run("notepad.exe")
winwaitactive ("Untitled - Notepad")
$text = wingettext ("[active]")
If stringinstr($text, "type stuff") then
    send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    send("like what?")
    sleep(1000)
    ("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
If stringinstr($text, "my callsign") then
    send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    send("KD8LVT")
    sleep(1000)
    send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
$quit=1;quit = 1 so the script will exit the loop and end
    EndIf

And I am Sooooooooooo sorry if this is in the wrong spot this is my firs post... i also attached the file of the script.interactive.au3

Link to comment
Share on other sites

Ho k8lvt,

Your first "If" statement never closes.

Either add an "EndIf" statement before the second "If" Or change the second "If" to "ElseIf"

Edit:

If you do a Send("{BS 12}") it will send Backspace 12 times.

Edited by Hannes123
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Try

run("notepad.exe")
winwaitactive ("Untitled - Notepad")
$text = wingettext ("[active]")
If stringinstr($text, "type stuff") then
    send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    send("like what?")
    sleep(1000)
    send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    If stringinstr($text, "my callsign") then
        send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
        send("KD8LVT")
        sleep(1000)
        send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
        $quit=1;quit = 1 so the script will exit the loop and end
    EndIf
EndIf
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

wow you guys are fast! anyways

i added a second EndIf that worked out good then and now notepad will open just fine but the script still won't take my text and backspace it then type what's wrong now?

:mellow::)

ill try else if

nope still wont take my text it just closes automatically... :) maybe because i still have that quit in there just noticed :)

nope Grrrrrrr

Edited by kd8lvt
Link to comment
Share on other sites

What do you want your script will do?

Something like that?

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
While 1
    Sleep(10); Idle processor
    $text = WinGetText("[active]")
    If StringInStr($text, "type stuff") Then
        Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
        Send("like what?")
        Sleep(1000)
        Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
    EndIf
    If StringInStr($text, "my callsign") Then
        Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
        Send("KD8LVT")
        Sleep(1000)
        Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
;~         $quit=1;quit = 1 so the script will exit the loop and end
        ExitLoop ; Exit cycle and ends the program
    EndIf
WEnd
Link to comment
Share on other sites

This is what I want the script to do this,

Take input from the keyboard "type stuff" then start typing "like what" then i want it to take my input "my callsign" and then it should type "KD8LVT"

I hope that isn't too confusing because just typing it gave me a headace...

acctually yea just like that THANKS DM666!!!

Edited by kd8lvt
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...