Jump to content

Random outside loop


Recommended Posts

Hi guys i was wondering what is the best approach to make it so that after the loop has played between 50 and 100 times it sends an other key with randomized interval without interupting the current loop.
 

this is my current script: 

Local $Paused
HotKeySet("{=}", "TogglePause")

While 1
Sleep(Random(90000, 100000))
Send("{o}")
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
       ;
   WEnd
EndFunc

 

 

Link to comment
Share on other sites

What application are you trying to automate this way ?  Seems to me that it is for a game, right ?  Please read forum rules first, so you know it is not allowed to discuss such matter here.

Link to comment
Share on other sites

9 hours ago, Nine said:

What application are you trying to automate this way ?  Seems to me that it is for a game, right ?  Please read forum rules first, so you know it is not allowed to discuss such matter here.

its just a random example for me to understand functions🤕

Link to comment
Share on other sites

  • Developers
6 hours ago, l00pDR said:

ts just a random example for me to understand functions🤕

Je meent het...

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

6 hours ago, Jos said:

Je meent het...

ik meen het🙂

I've looked into case and make it a count between 1 and 50 but it doesnt work the way i wanted.
And when counting in a while loop i couldnt get a second loop to merge with the first one
I was just wondering if its possible in any way to make a loop run x(random) ammount of times between a fixed ammount and when the random number is met perform a single action and repeat the loop.

 

Link to comment
Share on other sites

  • Developers
1 minute ago, l00pDR said:

ik meen het🙂

Not really as...

1 minute ago, l00pDR said:

I've looked into case and make it a count between 1 and 50 but it doesn't work the way i wanted.

This is an pretty specific statement so you do have an fixed goal here.....  so care to share what it really is?

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

20 hours ago, Jos said:

Not really as...

This is an pretty specific statement so you do have an fixed goal here.....  so care to share what it really is?

When im done filling a form i must wait a minute for filling the next, but it becomes rather tethious after a while so i need a second different sound to play after a random amount of times the first sound played so i can decide to stop or continue for the day

Link to comment
Share on other sites

Can you show an image of the form you are filling ?  While you are there, use Au3Info.exe tool on element of the form to see if we can get Control IDs from the application.  Show the result of the tool here.

Link to comment
Share on other sites

  • Developers
6 hours ago, l00pDR said:

When im done filling a form i must wait a minute for filling the next, but it becomes rather tethious after a while so i need a second different sound to play after a random amount of times the first sound played so i can decide to stop or continue for the day

... so as expected we went from "just a random example" to an real life automation challenge but you insist to remain vague and still want support without any real details.
Sorry to be so hars here, but simply be clear about what you want, with a clear definition of what you want that isn't working  or else just don't bother posting.  ( Ik hou graag van duidelijkheid ;) ) 

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

On 3/28/2021 at 9:21 PM, Jos said:

... so as expected we went from "just a random example" to an real life automation challenge but you insist to remain vague and still want support without any real details.
Sorry to be so hars here, but simply be clear about what you want, with a clear definition of what you want that isn't working  or else just don't bother posting.  ( Ik hou graag van duidelijkheid ;) ) 

Jos



 i dont know why this doesnt work:
 

$xR = Random(50, 100, 1)
   $xN = 0
   Do
      Sleep(Random(90000, 100000))
      Send("{o}")
      $xN += 1
   Until
   $xN = $xR

Also im sorry if i'm being unclear i'm not that good with words😊
 

Edited by l00pDR
Link to comment
Share on other sites

Nope.  Need to see the form with the info tool on its elements.  Wonder why you refuse to provide this information.  It is the third time I ask you the same, hope this is the last...

Link to comment
Share on other sites

  • Moderators

100pDR,

OK, enough of this pussy-footing around. if you want help we want to see an image of this form and the text of what the Au3Info tool tells you about it. No image and info = no help. I hope I making myself quite clear here.

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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