laolas Posted June 6, 2017 Share Posted June 6, 2017 Hey my plan is to send a key in random time. In this case "S", it should send a S randomly in between 4 Sec. Thanks Code: If ProcessExists("OS.exe") Then MsgBox(1,"Checking Client....","GEFUNDEN!!!") Else MsgBox(1,"Checking Client...","NICHT GEFUNDEN!!!") Exit EndIf while 1 Random (1000,4000,1) Send("{S}") wend Link to comment Share on other sites More sharing options...
water Posted June 6, 2017 Share Posted June 6, 2017 Welcome to AutoIt and the forum! Ich konnte in Deinem Post keine Frage finden Wo liegt das Problem? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 4 minutes ago, water said: Welcome to AutoIt and the forum! Ich konnte in Deinem Post keine Frage finden Wo liegt das Problem? Ich würde gerne in die While schleife einen cod reingeben der nach einer zufälligen zeit zwischen 1-4 sek den bustaben S schreibt. ich weiß ned wie ich das hinbekomm Link to comment Share on other sites More sharing options...
Developers Jos Posted June 6, 2017 Developers Share Posted June 6, 2017 Guess you need to add a sleep() statement that uses the random generated number of msecs. Jos 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 i dont know how to cod it :C pls help Link to comment Share on other sites More sharing options...
Developers Jos Posted June 6, 2017 Developers Share Posted June 6, 2017 Did you open the helpfile at all before answering or do you prefer me to code it for you? Jos 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 i also looked up many other forums and what they posted an tried it out, but i was not able to get it working... could you cod it for me pls Link to comment Share on other sites More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 Finally i maged to solve the problem Link to comment Share on other sites More sharing options...
kylomas Posted June 6, 2017 Share Posted June 6, 2017 laolas, 16 minutes ago, laolas said: Finally i maged to solve the problem Now you are ready to learn. Lets see your solution, it may help others! 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 5 minutes ago, kylomas said: laolas, Now you are ready to learn. Lets see your solution, it may help others! kylomas If ProcessExists(".exe") Then MsgBox(1,"Checking Client....","GEFUNDEN!!!") Else MsgBox(1,"Checking Client...","NICHT GEFUNDEN!!! Soll das Client gestartet werden?") Run (.exe") EndIf $pxs = PixelSearch(5,4,1916,1036,0xFE7427) while 1 If isArray($pxs) then ProcessClose ( "exe" ) EndIf sleep(random(1000, 5000, 1)) Send("{S}") wend there is my solution Link to comment Share on other sites More sharing options...
Developers Jos Posted June 6, 2017 Developers Share Posted June 6, 2017 I've tidied your source a little and it seems to me you have a logic issue in there as you one check for the pixel one time and use the outcome forever: If ProcessExists(".exe") Then MsgBox(1, "Checking Client....", "GEFUNDEN!!!") Else MsgBox(1, "Checking Client...", "NICHT GEFUNDEN!!! Soll das Client gestartet werden?") Run(.exe") EndIf $pxs = PixelSearch(5, 4, 1916, 1036, 0xFE7427) While 1 If IsArray($pxs) Then ProcessClose("exe") EndIf Sleep(Random(1000, 5000, 1)) Send("{S}") WEnd Is that what you want for the "program" to work correctly? Jos 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 Yeah everything there has its role, i have one more question i would like to have a timer how the program was opened, so i figured out a way to make it by making screenshots form the desktop where the time is in the right corner... but my problem is that when i make a screen only one is made because the file name allready exist, how i mage it to save the screenshot with a random generated name ? like "1232asd2.jpg" #include <ScreenCapture.au3> _ScreenCapture_Capture(@DesktopDir & "\GDIPlus_Image1.jpg") Link to comment Share on other sites More sharing options...
Developers Jos Posted June 6, 2017 Developers Share Posted June 6, 2017 1 minute ago, laolas said: Yeah everything there has its role, Doubt you understood what I tried to tell you... maybe read that first sentence of my previous post again about doing one a pixelsearch one time. Jos 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 I tested the script but it seam working :S now i tested it twice, yeah there is a problem :S it only check it one(pixel search) time and only when its opened :S how i manage to check if this pixel exist in a loop ? Link to comment Share on other sites More sharing options...
BrewManNH Posted June 6, 2017 Share Posted June 6, 2017 Putting the pixelsearch INTO the loop would seem to be the method to use don't you think? 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 GudeHow 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 The plan is that the script check if this pixel is found(this pixel only exist if there is an error) and then the programm will be closed, for this i need the pixel search in a loop Link to comment Share on other sites More sharing options...
BrewManNH Posted June 6, 2017 Share Posted June 6, 2017 20 minutes ago, laolas said: for this i need the pixel search in a loop So, what is stopping you from putting it into the loop you already have? 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 GudeHow 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 More sharing options...
laolas Posted June 6, 2017 Author Share Posted June 6, 2017 i found the mistake, now i only need to fix that sreenshot issue Link to comment Share on other sites More sharing options...
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