Jump to content
Sign in to follow this  
robotronick

Random

Recommended Posts

robotronick

Hi,

Ive been looking around these forums a while now and havent seen anything related to my question.

I know how to random choose between two sleep times being :

Sleep(random(250,350)) oÝ÷ ØÚ0Z­#§µçm¡Ú"²W­¶¬r¸©¶¶§v¥ÉÈh¢ÇzÜz}ÚrبÄá¢Ç·iËb¢{­æ¥W¶j.±ç%É,¢wb}÷«z{¢Ýv­zĨ#§¶+m¡Èh¢Ç¨ê¶,{v§uÚ"¶Øb²+0«Hl¡ö«në]¡ë'·
+«­¢+ءɹ½´¡5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌäÀ°ÈäÀ°Ä°Ì¤¤°¡5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°àÜÀ°ÔÌÀ°Ä°Ì¤¤°¡5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÈÀÔ°ØÐÀ°Ä°Ì¤¤¤

What Am I doing wrong? PLs help me out .

Big thx!!

Robotronick

Edited by robotronick

Share this post


Link to post
Share on other sites
tmo

use random(1,3) and look for Switch...Case...EndSwitch in the autoit helpfile

Share this post


Link to post
Share on other sites
frank10

ok this is what I got so far

Switch @random

Case 1

MouseClick("left", 390,290, 1, 3)

you should make:

Switch random(1,3)

Case

....

@random isn't an existing macro.

Share this post


Link to post
Share on other sites
herewasplato

Switch random(1,3,1)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
jjldj

$rand = Random(1, 3, 1)

Select

Case $rand = 1

MouseClick("left", 390,290, 1, 3)

Case $rand = 2

MouseClick("left", 870,530, 1, 3)

Case $rand = 3

MouseClick("left", 205,640, 1, 3)

EndSelect

Share this post


Link to post
Share on other sites
herewasplato

$rand = Random(1, 3, 1)

Select

Case $rand = 1

MouseClick("left", 390,290, 1, 3)

Case $rand = 2

MouseClick("left", 870,530, 1, 3)

Case $rand = 3

MouseClick("left", 205,640, 1, 3)

EndSelect

Switch Random(1, 3, 1)
    Case 1
        MouseClick("left", 390, 290, 1, 3)
    Case 2
        MouseClick("left", 870, 530, 1, 3)
    Case 3
        MouseClick("left", 205, 640, 1, 3)
EndSwitch
...works just fine...

The OP only needed to add the flag "1" to have Random return an integer.

Your code works as well - but no need for the extra code in the Case expression.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
robotronick

Thx!! It works now just the way I wanted !

A little question: what does OP mean? :">

Share this post


Link to post
Share on other sites
jjldj

When I copy and run your code, I get the following:

"Case" statement with no matching "Select" statement.

Share this post


Link to post
Share on other sites
herewasplato

Thx!! It works now just the way I wanted !

A little question: what does OP mean? Posted Image'>

The person that made the Original Post, as in:

The OP only needed to add the flag "1" to have Random return an integer

-or-

the Original Post itself, as in:

See the code in the OP.

Just forum shorthand.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
tmo

Thx!! It works now just the way I wanted !

A little question: what does OP mean? :">

OP is the one who created the topic, i.e. you

Share this post


Link to post
Share on other sites
herewasplato

When I copy and run your code, I get the following:

"Case" statement with no matching "Select" statement.

Run it from within the SciTE editor and copy/paste/post the output:

>"C:\Program Files\AutoIt3\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "c:\Temp\SciTE-temp.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+> Starting AutoIt3Wrapper v.1.7.4

>Running AU3Check (1.54.6.0) params: from:C:\Program Files\AutoIt3

+>AU3Check ended.rc:0

>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "c:\Temp\SciTE-temp.au3"

+>AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 1.759

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
jjldj

Run it from within the SciTE editor and copy/paste/post the output:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\.....\Desktop\Test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

>Running AU3Check params: from:C:\Program Files\AutoIt3\SciTE\au3check\

+>AU3Check ended.rc:0

>Running:(3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\.......\Desktop\Test.au3"

C:\Documents and Settings\trsb0277\Desktop\Test.au3 (15) : ==> "Case" statement with no matching "Select" statement.:

Case 1

->AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 2.554

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.