Jump to content

Recommended Posts

Posted

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

 

 

 

 

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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 :D

Posted

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

Posted

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

Posted
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

 

  • Developers
Posted

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

Posted

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")

 

  • Developers
Posted
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.
  :)

Posted

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 ?

Posted

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

Posted

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...