Jump to content

Recommended Posts

Posted (edited)

Hey so basically I made a script that sends different values all the time. The value must be between 1 and 500 in a non-decimal format. The coincidence for sending the same value twice is pretty low but it does happen some times and it's annoying to watch.

So thats why im asking you guys if you have any ideas how I can prevent this? Thanks in advance, you guys are awesome!

While 1
    Send(Random(1, 500, 1))
    Sleep(500)
    Send("{ENTER}")
WEnd
Edited by Sfikes
Posted

set a variable and check it, then continueloop before any actions if it matches the last random number

$lastrand = 0
$newrand = 0

While 1
    $newrand = Random(1, 500, 1)
    If $newrand = $lastrand Then continueloop
    msgbox(0, '' , $newrand)
    $lastrand = $newrand
    Sleep(500)
WEnd

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Posted
#include <array.au3>

Local $array[500]
For $i=0 To 499
    $array[$i] = $i +1
Next
_ArrayDisplay($array)
_ArrayShuffle($array)
_ArrayDisplay($array)
For $i=0 To 499
    Send( $array[$i])
    Sleep(500)
    Send("{ENTER}")
Next
MsgBox(64+262144, Default, "All 500 numbers sent.",0)

#cs
Place the cursor after this line and then press F5 (GO)


#ce

 

App: Au3toCmd              UDF: _SingleScript()                             

Posted
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
WinActivate("[CLASS:Notepad]")
HotKeySet("{ESC}", "_Exit") ;Press ESC to exit...


$iMin = 5
$iMax = 500
$sHistoric = "|"
$i = $iMin
While Sleep(1) And $i <= $iMax
    $iRandom = Random($iMin, $iMax, 1)
    If StringInStr($sHistoric, "|" & $iRandom & "|") Then
        ContinueLoop
    Else
        $sHistoric &= $iRandom & "|"
        $i = $i + 1
        ToolTip($i - 1)
        Send($iRandom)
        Send("{ENTER}")
    EndIf
WEnd


Func _Exit()
    Exit
EndFunc   ;==>_Exit

 

Posted
On 2016-10-13 at 3:09 AM, Exit said:
#include <array.au3>

Local $array[500]
For $i=0 To 499
    $array[$i] = $i +1
Next
_ArrayDisplay($array)
_ArrayShuffle($array)
_ArrayDisplay($array)
For $i=0 To 499
    Send( $array[$i])
    Sleep(500)
    Send("{ENTER}")
Next
MsgBox(64+262144, Default, "All 500 numbers sent.",0)

#cs
Place the cursor after this line and then press F5 (GO)


#ce

 

Hey! Great solution but i want the script to move on at any given time. So for example when clock hits 23:00 this script should not continue and move on to next function

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