Chobyhy Posted July 17, 2006 Posted July 17, 2006 (edited) Forum help first: nvm im not having them anymore Autoit Script Help: im new to autoit and i just learned to start scripting today so i need some basic helps. I wrote a script where when i press the "delete" key in a game that it would hit "enter" then type messages then hit back "enter" to send it. But the problem is, script doesnt even start up or show a tray icon and it doesnt work since it's not running. Can you help fix it. Global $Paused HotKeySet ( "{DELETE}", "msgone") HotKeySet ( "{PGUP}", "quit") Func msgone() Send ( "{ENTER}") Send ( "MESSAGES") Send ( "{ENTER}") EndFunc Func quit() Exit 0 EndFunc Second Autoit Help: Is there anyways for autoit to detect key presses and key releases it. I want to make a script where i press and hold "a" key, it will do what i tell it to and keep looping until i release "a" key. How would i make Autoit detect presses/releases of a key. Third Autoit Help: How can you make a script so when a key is held down. the following thing occurs When Key is HELD DOWN: Send( "x") (Hits this once) then holds... Send( "{SHIFT}") (make it hold shift some how) Mouse click and hold cordinate. When Key is released Send(" Y") Shift + Mousecoordinate thats been held down is released Edited July 17, 2006 by Chobyhy
Nomad Posted July 17, 2006 Posted July 17, 2006 Second Autoit Help: Is there anyways for autoit to detect key presses and key releases it. I want to make a script where i press and hold "a" key, it will do what i tell it to and keep looping until i release "a" key. How would i make Autoit detect presses/releases of a key. While (_IsPressed(41)) ;"A" pressed ;do whatever WEnd You need the beta version for this. Nomad
spyrorocks Posted July 17, 2006 Posted July 17, 2006 (edited) you must put in a loop in your code somewhere so that the interpriter wont hit the end, Like so:Global $Paused HotKeySet ( "{DELETE}", "msgone") HotKeySet ( "{PGUP}", "quit") ;Start New Code while 1 sleep(100) wend ;End New Code Func msgone() Send ( "{ENTER}") Send ( "MESSAGES") Send ( "{ENTER}") EndFunc Func quit() Exit 0 EndFuncNow, it will stay resident.EDITDid you read the helpfile yet? Also, it would be a good idea to download the Beta. Edited July 17, 2006 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 wutt? what beta? im lost i downloaded the Autoit v3 i think. and what does While 1 Sleep(100) WEnd exactly do
Nomad Posted July 17, 2006 Posted July 17, 2006 wutt? what beta? im lost i downloaded the Autoit v3 i think. and what doesWhile 1Sleep(100)WEndexactly doThere's a help file included with AutoIt that you are supposed to reference before posting questions here that can be answered there. I suggest looking in the help file and using the examples, then examining the examples until you understand how and why they work. Then try searching the forums if you still don't completely understand. Then post questions here along with your script when all else fails.Beta is the "Beta" version of AutoIt, and it's the only way you can use the _IsPressed function, and you're going to need it to accomplish what you asked.Nomad
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 There's a help file included with AutoIt that you are supposed to reference before posting questions here that can be answered there. I suggest looking in the help file and using the examples, then examining the examples until you understand how and why they work. Then try searching the forums if you still don't completely understand. Then post questions here along with your script when all else fails.Beta is the "Beta" version of AutoIt, and it's the only way you can use the _IsPressed function, and you're going to need it to accomplish what you asked.Nomad i did. i wrote the script after reading the whole manual. took me an hour or two. anyways isnt Sleep like pause? it says pause for 0.1 sec?is beta version like a newer version and where do i dl it?
NELyon Posted July 17, 2006 Posted July 17, 2006 downloads page>>> very bottom. says "Download Beta" in a big red button
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 i went and it went to some weird pagehttp://www.autoitscript.com/autoit3/files/beta/is the dl link broken? how do i dl or something?
spyrorocks Posted July 17, 2006 Posted July 17, 2006 this should be what u want: http://www.autoitscript.com/autoit3/files/...-beta-Setup.exeabout the code:while 1 sleep(100) wendThe loop thyere will force autoit to stay open, thus allowing you to carry out your hotkey actions.The sleep(100) command is optional, but it will help reduce stress on your CPU because tight loops like this:while 1 wendwill slow down your compuer while the script is running. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
taurus905 Posted July 17, 2006 Posted July 17, 2006 i went and it went to some weird pagehttp://www.autoitscript.com/autoit3/files/beta/is the dl link broken? how do i dl or something?Chobyhy,Welcome to the AutoIt forum. To download the latest beta, go here:http://www.autoitscript.com/autoit3/files/beta/autoit/Then click on:autoit-v3.1.1.130-beta-Setup.exetaurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 isnt 100 still pretty fast? wouldnt it still slow my comp by alot?
spyrorocks Posted July 17, 2006 Posted July 17, 2006 (edited) should be OK. Increase it if you like. it doesent matter. edit actually, i guess you could just put this coede insted: sleep(999999999999999999999) insted i guess. even better for your cpu. Edited July 17, 2006 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 so higher it is the less lag? cuz i play game while running script. is 15000 good enuff?
spyrorocks Posted July 17, 2006 Posted July 17, 2006 (edited) how long do you play the game for? If your computer is crap, just put this in: sleep(99999999999999999999999999999999999) insted of the loop. it doesent really matter if you put a huage value in a loop. i would just use that sleep function i just sayed. its easyer and thewre is like NO cpu usage. If you play it constantly, paste it in there a few times. Edited July 17, 2006 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
taurus905 Posted July 17, 2006 Posted July 17, 2006 isnt 100 still pretty fast? wouldnt it still slow my comp by alot?Chobyhy,You can always go to your 'Windows Task Manager' (CTRL-ALT-DEL) and click on the 'Processes' tab. Then locate 'AutoIt3.exe' under the 'Image Name' column. This will show you the CPU and memory usage. You can then adjust your sleep time to see what effect it has.I recently started using 'OnEvent' mode, instead of the message loop, and it has greatly reduced my CPU usage from over 30% down to around 3%. But you may want to stick with the message loop method until this becomes an issue with your scripts.taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs
Chobyhy Posted July 17, 2006 Author Posted July 17, 2006 hmm strange so CPU is at 0 but when i click the key that sets the trigger it goes up to 40 is that too high?
spyrorocks Posted July 17, 2006 Posted July 17, 2006 No.... not unless your game takes up more then 80% of cpu, but even then it will be OK. i run stuff on my computer at full cpu all the time and it works perfecly with no ill effects. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Nomad Posted July 17, 2006 Posted July 17, 2006 Sleep is just a delay to keep your script from hogging all the cpu. Without a sleep command, the script runs as fast as it possibly can, and this usually means as fast as your cpu can process. There are some functions which automatically sleep, like GUIGetMsg(). I believe it automatically sleeps 10 milliseconds. Unless you have an absolute ancient cpu, a sleep time of 10-15 should be about the maximum you will need to prevent a script from lagging your computer (unless you have the cpu already at a very high load). On a 266 Mhz processor, which is what I use when scripting, I can run scripts for Diablo II with Sleep(10) and have no script related lag. This is why I like using an older machine to script. If it'll run on this processor, it should run on any modern computer with ease. Nomad
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now