Sign in to follow this  
Followers 0
viper3000

run random exe flie

8 posts in this topic

ok i want to run a random script exe fileand i seem to be a lil stumped this is the way i figer it should work but it hazent yet

dim $1 = script1.exe
dim $2 = script2.exe
dim $3 = script3.exe
dim $4 = script4.exe
dim $5 = script5.exe
dim $6 = script6.exe
dim $7 = script7.exe

dim $i1
$i1 = Random( 1, 31, 1)

while 1 = 1
sleep (10000)
Run, $il
sleep (10000)
wend

the main exe and all the sub exes r in the same folder

can any one help and maby explan how it works a little better?

Share this post


Link to post
Share on other sites



I've not tested it, but it would be something like this if I were doing such a thing.

#Include <File.au3>

$aFiles = _FileListToArray(@ScriptDir,"*.exe",1)

If @error Then Exit

$iRnd = Random(1,$aFiles[0],1)

Run($aFiles[$iRnd])

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

ok i want to run a random script exe fileand i seem to be a lil stumped this is the way i figer it should work but it hazent yet

the main exe and all the sub exes r in the same folder

can any one help and maby explan how it works a little better?

First you need to redefine you Run command, use Run($il) instead of the way you wrote it.

Second you have 7 commands to run, and you're trying to get a random number up to 31, 24 of your results will give you errors.

Third, you are running a different file every 10 seconds with no way to exit your script other than killing it in Task Manager or through the tray icon. Do you REALLY want it to run the same program every 10 seconds?

Hopefully this will help you find where your mistakes are and be able to correct them.


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

Share this post


Link to post
Share on other sites

$debug = 1

dim $aRun[5] = [4, "script1.exe", "script2.exe", "script3.exe", "script4.exe"]
$rand = random(1, 4, 1)

if $debug = 1 then
    msgbox(0, "running...", $aRun[$rand])
Else
    run($aRun[$rand])
EndIf

Share this post


Link to post
Share on other sites

Welcome back stranger.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thx for the replys

and yes i normaly put esc hotkey as end and pause key as pause

and thats isent the egzact script i want to use. the 1 i want to use haz persanal info in it (ie. passwords email accounts and bank info) i wont be posting it compleatly intact but i will post it but wut it will do in the end is collect info from sevral sorces (ie. email, bank statment) and putting it into a spreadsheet to keep track of things in one place the randome just makes it more fun lol im just odd like that ;) and like doing things the hard way. ya learn more like that.

I'm curious as to why one would need to run a random file every 10 seconds. This isn't something one can Google easily, and I'm no mind reader.

that waz just an (ie.) script

$debug = 1

dim $aRun[5] = [4, "script1.exe", "script2.exe", "script3.exe", "script4.exe"]
$rand = random(1, 4, 1)

if $debug = 1 then
    msgbox(0, "running...", $aRun[$rand])
Else
    run($aRun[$rand])
EndIf

the (1, 4, 1) parts means to run random file betwen 1 and 4 then 1 ??

im not sure i understand wut that means

maby a link or 2 to some research?

Share this post


Link to post
Share on other sites

Straight from the help file:

Random ( [Min [, Max [, Flag]]] )

Min [optional] The smallest number to be generated. The default is 0.

Max [optional] The largest number to be generated. The default is 1.

Flag [optional] If this is set to 1 then an integer result will be returned. Default is a floating point number.

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