Jump to content

Randomization


Recommended Posts

Guest Marmis

Yay, my first post.

Anyway, I got a few questions for you. What would be the best way to do these following things with AutoIt v3 if they can be made "easily" with it at all. I have made a few pretty simple programs with AutoIt v3 and also have an average knowledge of C++.

When I have my mouse moved in to a right place, let's say that is my web browser's location bar. I want to define quite a few, let's say a hundred different pages which it could go to, how would I do that? How could I easily(?) define the different pages?

Second, how could I make the Sleep() times random? What about this: how to make the program choose from alternatives A, B and C? They could be different kinds of mouse clicks.

I have tried looking up answers from the Online Documentation but so far with little luck.

Thanks in advance for your answers.

Link to post
Share on other sites

When I have my mouse moved in to a right place, let's say that is my web browser's location bar. I want to define quite a few, let's say a hundred different pages which it could go to, how would I do that? How could I easily(?) define the different pages?

<{POST_SNAPBACK}>

Ok, define the web pages in a text file.

<include #file.au3>
Opt(WinTitleMatchMode,4)

$hwnd_IE = WinGetHandle("Internet Explorer")
$s_URLfile = "C:\test.txt"
_FileReadToArray($s_URLFile,$a_URLFile)

$a_URLFile[0] is the # of lines in the file.

So, to choose a random site would be:

$i_site = Random(1,$a_URLFile[0],1)

Then just send it to the location bar....or not if IE's being cranky.

ControlSend($hwnd_IE,"","Edit1",$a_URLFile[$i_site],1); sends to IE directly
ControlSend($hwnd_IE,"","Edit1","{enter}",0); sends to IE directly

RunWait(@ComSpec & " /c " & 'Start "' & $a_URLFile[$i_site] & '"'', "", @SW_HIDE); spawns a new IE at the specified address.
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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

    No registered users viewing this page.

×
×
  • Create New...