Jump to content

Some help


Recommended Posts

I hope this is the right forum to post this question. I am very new to Autoit and have written a little script. I would like it to hit the w key every 10 seconds in my script. When i run it, it kinda works, it hits w over and over non stop. I get a ton of scripts running at once to. I dont think im telling it to exit or something right. Any help would be great thanks.

Hope this helps you understand, thanks for feedback guys!

Run ("new1.exe")
WinWaitActive ("World of Warcraft")
Send ("{w}")
Sleep (10000)
WinCLose ("World of Warcraft")
Exit
Edited by Ford21
Link to comment
Share on other sites

  • Developers

Let me guess: You called your script new1 and compiled it ... right ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

ähm... yes, your problem is that you use the Run() function... it's much better and faster and only uses 1 file opened if you use a loop:

HotkeySet("{ESC}", "Exit1")

While 1
    WinWaitActive ("World of Warcraft")
    Send ("{w}")
    Sleep (10000)
Wend

Func Exit1()
    WinClose ("World of Warcraft")
    Exit
End Func
Edited by Lord_Doominik
Link to comment
Share on other sites

You need to put your Send key in a loop so that it repeats. "While 1" creates a condition that is always true and thus an infinite loop.

To stop this program, right-click on its tray icon and stop it. To do this more gracefully, read the documentation on HotKeySet and look through the forum for examples of how to create a Terminate function.

Dale

Run ("new1.exe")
WinWaitActive ("World of Warcraft")

While 1
    Send ("{w}")
    Sleep (10000)
Wend

WinCLose ("World of Warcraft")
Exit

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

haha, i was faster and built hotkeyset in :evil:... because he don't have a gui xD... but i removed the Run("newl.exe") part, because i think his file is named newl.exe... because he said that the w key always was hit, but many programs were open... and if you don't remove the Run function he gets every 10 seks 2 times the w key... xD

ahm and @jdbe iit can't be so that he called is script new1.au3... 'cause he said that the w key always gets pushed... :D

:)

Edited by Lord_Doominik
Link to comment
Share on other sites

Please see Lord_D for all of your future custom programming needs... he won't require that you learn anything...

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

all the needed i said ^^... that it's better with a loop... and i think he'll understand mine too... it's called learning by doing and not learning by explaining ^^... it's better for his future in programming if he checks himself with the helpfile or with testing, what the different code lines do... and i think that this isn't a very difficult script... if it is more complicate you're right, than it's better to explain everything...

Link to comment
Share on other sites

ähm... yes, your problem is that you use the Run() function... it's much better and faster and only uses 1 file opened if you use a loop:

HotkeySet("{ESC}", "Exit1")

While 1
    WinWaitActive ("World of Warcraft")
    Send ("{w}")
    Sleep (10000)
Wend

Func Exit1()
    WinClose ("World of Warcraft")
    Exit
End Func

<{POST_SNAPBACK}>

When I try this code I get the error Func has no matching end func, any clue? I tryed puting a end on it but no luck, Thanks Edited by Ford21
Link to comment
Share on other sites

You need to put your Send key in a loop so that it repeats.  "While 1" creates a condition that is always true and thus an infinite loop.

To stop this program, right-click on its tray icon and stop it.  To do this more gracefully, read the documentation on HotKeySet and look through the forum for examples of how to create a Terminate function.

Dale

Run ("new1.exe")
WinWaitActive ("World of Warcraft")

While 1
    Send ("{w}")
    Sleep (10000)
Wend

WinCLose ("World of Warcraft")
Exit

<{POST_SNAPBACK}>

This one gives me a error that is wierd, MZ then a squard, next line MZ^ERROR unable to parse line. Not real sure, Any clue? Thanks
Link to comment
Share on other sites

Hmm I tried to modify your script to get it to work. It works like my first one, opens like 10000 scripts or something, but no error lol.. Any advice please. Thanks again guys

O also when this happens i have no clue how to stop all of them, I end up having to reboot, any commands fro this, cnt c dont seem to work.

Run ("crazy.exe")

While 1
    WinWaitActive ("World of Warcraft")
    Send ("{w}")
    Sleep (10000)
Wend
Edited by Ford21
Link to comment
Share on other sites

When I try this code I get the error Func has no matching end func, any clue? I tryed puting a end on it but no luck, Thanks

<{POST_SNAPBACK}>

It should be EndFunc without any space inbetween.
Link to comment
Share on other sites

When I try this code I get the error Func has no matching end func, any clue? I tryed puting a end on it but no luck, Thanks

<{POST_SNAPBACK}>

ahm sry, did a typing error... it is EndFunc and not End Func...

this is correct

HotkeySet("{ESC}", "Exit1")

While 1
    WinWaitActive ("World of Warcraft")
    Send ("{w}")
    Sleep (10000)
Wend

Func Exit1()
    WinClose ("World of Warcraft")
    Exit
EndFunc

lxp already corrected me... thanks to him ^^...

Edited by Lord_Doominik
Link to comment
Share on other sites

Awesome Guys, I got it working good enought to do what I needed. I must thank all you guys for your help, with out you this script would have never worked. I learned a few new things also!

Thanks again guys

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