Sign in to follow this  
Followers 0
Bellzemos

Beginner's questions

8 posts in this topic

Hello!

So I've started with Autoit, went through the tutorial and would like to make my own scripts but I, ,of course, don't know all the commands/syntax needed. I hope you can help me.

How would I make the script check if a specific program is running and then if yes, close it, if not, do this-and-that?

I've read that AutoIt is easy but it's not SO easy. Where could I get more tutorials?

Thank you!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, Bellzemos, welcome to the forum. We're happy to help, just realize that we help you learn, rather than doing it for you.

To find out if an application is running, you can go a couple of ways: you can look for a specific window (WinExists), or you can look for the Process (ProcessExist). Look in the help file under either (or both) of these functions, and you'll see an example of an If statement. That should point you in the right direction.

 

Once you decide on direction, if you run into trouble, feel free to post your script here. We will do what we can to assist.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you!

This is what I'm trying to automate (the video link is in the first post):

'?do=embed' frameborder='0' data-embedContent>>

And this is what I wrote so far - but it's not working properly:

WinClose("C:\Program Files (x86)\Winamp\winamp.exe")
Sleep(1000)
Run("C:\Windows\System32\firefaceusb.exe")
WinWaitActive("Fireface USB Settings")
Send("{UP}")
Send("{UP}")
Send("{ENTER}")
Run("C:\Program Files (x86)\Skype\Phone\Skype.exe")
MsgBox(0, "Audio Latency", "Latancy is set to 512. Click on OK after you quit Skype.")
WinClose("C:\Program Files (x86)\Skype\Phone\Skype.exe")
Sleep(1000)
Run("C:\Windows\System32\firefaceusb.exe")
WinWaitActive("Fireface USB Settings")
Send("{DOWN}")
Send("{DOWN}")
Send("{ENTER}")
MsgBox(0, "Audio Latency", "Latancy is set back to 128.")
Edited by Bellzemos

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Copy your code to the clipboard, click the blue box with a white A (in the editor tools area just below the smiley's) and paste your code in the popup that appears. ;)

Edited by czardas

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hello!

You can use [ autoit ] [ / autoit ] withoutspaces

in the forum, if you post your code between them it makes it look like in the program. also I suggest using wintwaitactive instead of sleep anytime thats possible

(Im a beginner too so dont take my advise that seriusly :) you will learn your own best practice in time anyway)

(edited because I actually wrote it withoutspaces at first.... )

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites

Thanx, I fixed my last message. And I am using the WinWaitActive command too. Any suggestions are welcome and much appreciated to make this work the way I would like it to (as seen in the link).

Share this post


Link to post
Share on other sites

First, you should try to better explain "but it's not working properly".

Look at some of the example code for the functions you use, and specifically any which use or test @error.

looking at @error in general can't hurt either.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
There are various languages, they each have their niche of expertise.
But among all the AutoIt has the best: the Help file.
You write a script, save, enter a command, press F1, and there is the description and the thing that facilitated learning AutoIt: an example.
This single example, simple, direct, was key so I could learn.
If there were more, I would not give much willing to learn more than this single example.
Want to learn AutoIt? But never forget the Help file! It is very important to me. My constant source of research.
 
Br, Detefon.

 

m(o.O)m

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