Jump to content

Noob question about while loops/if statements


cjm80
 Share

Recommended Posts

Skip this paragraph if you don't care and will just answer my question :). I just started using this about a week ago, have been trying to figure everything out. Unfortunately before this Javascript was the only computer language I had ever learned. I had no reason for loops/if statements up to this point, as could just use winwaitactive most of the time, but now here's what i need help with:

This application has a bug (being fixed right now, just hasn't been) that won't let me login unless you SPAM click the log in button. My computer has no mouse, as I use a wireless keyboard with a little touchpad, so i can't spam click. I want to have autoIT do the spamming for me. Here is what I have written:

while(WinExists("SmoothRidgidBodyExample") = True) {
if (WinExists("SmoothRidgidBodyExample", "Menu") = true) {
MouseClick("primary",300,630,1,1);
Sleep(1000);
if ((WinExists("SmoothRidgidBodyExample", "Login")) = true) {
MouseClick("primary",400,330,30,1);
Sleep(2000)
}
} else {
Exit;
}
);

Like I said, tiny noob script, but at least up until this point ive taught myself that eh?

How might I make this code work as it's meant? (Constructive criticism welcomed!)

Edited by cjm80
Link to comment
Share on other sites

cjm80,

How were you introduced to AutoIT and how did you find this forum? These are not idle questions. We will help any serious developer whether professional or hobbyist however, you must adhere to the forum rules which also covers automated login as well as other things. You may want to read them again, in entirety.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Here's a hint, this is AutoIt and AutoIt doesn't have line ending characters ("{").

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

cjm80,

How were you introduced to AutoIT and how did you find this forum? These are not idle questions. We will help any serious developer whether professional or hobbyist however, you must adhere to the forum rules which also covers automated login as well as other things. You may want to read them again, in entirety.

kylomas

Was introduced to autoIT when searching for something to automate some changing of amp settings for my guitar a week ago, so that throughout playing a song if I timed it correctly, my settings would change as different guitars came in from a song, so that i would not have to worry about buying any new pedals/etc. This forum was on the main page. And yet again, I'm not trying to do anything against any of the rules. There is a bug with the app, where I can only login if i press a button repeatedly. This code doesn't type anything, and all it clicks are "Menu" "Login". I have a wireless keyboard that cost me $30, so it doesn't work very well. When trying to spam click, it just sticks down and says i held the button for the time i was clicking. You can go to their forums and find this bug if you'd like. Happens in all of their applications when trying to log in at the moment.

Link to comment
Share on other sites

cjm80,

I see. You will find the expertise on this forum to be excellent. You might want to avoid certain words, however, spam being one of them. I don't know what the curly braces are in your code. Follow BrewmanNH's advice. Post if you have more problems.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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