Jump to content

Expression errors?


Recommended Posts

ControlSend("Title","","","8")

Sleep(400)

ControlSend("Title","","","9")

Sleep(400)

ControlSend("Title","","","0")

While 1

$check = ProcessExists("title.exe")

If $check = 0 Then Terminate()

$rand = Random(1,7,1)

ControlSend("title","","",$rand)

If $rand < 5 Then

$rand2 = $rand(1000)

Sleep($rand2)

Else

Sleep(1100)

EndIf

WEnd

When I run this I keep getting an expression error listed in the line ControlSend("Title","","","0"), error says line 14 which is the line that is on. I had an If then statement after that, but would recieve and error on line 15 which had nothing written. the only thing above the first control send are comments I removed the if then and now it's error on 14

The controlsends do complete before I get the error and it never enters the While loop

What it's supposed to do is send 8,9,0, then generate a random number between 1 and 7 send that number then if the number is under 5 sleep that many seconds before the next send and keep doing the random sends

Also getting an issue with

$ProEx = ProcessExists("title.exe")

If $ProEx = 0 Then Terminate()

EndIf

Getting syntax error on EndIf

Edited by tigerray00
Link to comment
Share on other sites

ControlSend("title","","",$rand) is wrong because you do not have a control ID.

If condition then something

endif

is wrong; it should be

if condition then something ;no endif for a single-line IF

or

if condition then

something

endif

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

ControlSend("title","","",$rand) is wrong because you do not have a control ID

There is no control ID, I'm sending to the window itself, which actually doesn't have to have a speicific ID. The sends do happen exactly as instructed, but after the last on it errors then doesn't enter the loop, and I get an expression error at ControlSend("title","","","0"), should I have it set for raw or is there something else?

Thanks for the info on the if statements, that fixed that part of it.

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...