Jump to content
Sign in to follow this  
dasiuss

parameters to program?

Recommended Posts

dasiuss

hi i want to run one program (www pages checking) 5 times at once. but every time with other url.

ofc i can take tis program to function and run like:

URLCheck($url)

but i want it at once. so i need to run 5 several process? how to give URL to process?

or how to do 5 function at once in 1 process?

thx

Dasiuss

Share this post


Link to post
Share on other sites
dasiuss

you don't understand.

i need it 5 times with 5 several URLs. (never know what URL you need this time)

Share this post


Link to post
Share on other sites
Juvigy

You can pass the url as a command line parameter.

check the :

$CmdLine[0] is number of parameters
$CmdLine[1] is param 1 (after the script name)
$CmdLine[2] is param 2 etc
...
$CmdLine[$CmdLine[0]] is one way to get the last parameter...

 

So if your script is run like this:

    AutoIt3.exe myscript.au3 param1 "this is another param"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... this is another param

@ScriptName equals... myscript.au3

Share this post


Link to post
Share on other sites
Tvern

@Dasiuss: Can you eleborate a little on what the program should do? In most cases I find that a single program is all there is needed. If for example you want to download the page source of multiple pages at once you could use a construction like the one I posted here. If you want to display multiple pages in IE it could get more complicated, but I'd still advise against running more then one instance of the same script.

Share this post


Link to post
Share on other sites
dasiuss

@Juvigy

but how write in script to receive this parameters?

@Tvern

in work i have to do page scan for 30-50 firms (amount changes everyday)

so i must do some steps:

1 enter scanner page

2 click on firm name to scan this firm

3 wait for end of scan (scan lasts 10 - 30 seconds)

4 click on next firm to scan

5 wait again

etc.

ok its no problem to write it in au3.

but i have 3 servers (3 scanners) where i can do this scans.

if program use only 1 server then it lasts 40 minuts.

i just want to use all 3 servers.

i have 3 functions (1 for every server) and i can run it like this:

for $i = 0 to ubound($url)-1 step 3

scan1($url[$i])

scan2($url[$i+1])

scan3($url[$i+2])

next

but it has no sense.

its still only 1 server at once.

i can do every step in other 'for' loop. but then if server1 is faster then it must wait for other servers.

so i need to run 3 independent programs (or functions) and one other program to distribute links... ( maybe server1 can do more links that server2... )

thx for any help

p.s.

is this multi-threating or multitasking or multiprocessing or something like that?

Edited by dasiuss

Share this post


Link to post
Share on other sites
Juvigy

if you start your script as :

myscript.exe www.microsoft.com

In your script :

$CmdLine[1] equals www.microsoft.com so you can do:

_IENavigate($CmdLine[1])

Share this post


Link to post
Share on other sites
martin

if you start your script as :

myscript.exe www.microsoft.com

In your script :

$CmdLine[1] equals www.microsoft.com so you can do:

_IENavigate($CmdLine[1])

Yes, and here is a way to keep some number of instances of scan.exe going.

$running = 0; the number of scripts running
$index = 0
Const $MAXPROCS = 3; how many scripts to run at once
Dim $pids[$MAXPROCS]
Dim $url = StringSplit('abc.com|def.com|zsx.com|123.com', '|');the list of urls (could be read from some file maybe)

Do
    For $n = 0 To $MAXPROCS - 1
    If $pids[$n] = 0 And $index < UBound($url) - 1 Then
    $pids[$n] = Run("scan.exe " & $url[$index])
    $running += 1
    $index += 1
    ElseIf Not ProcessExists($pids[$n] Then
    $pids[$n] = 0
    $running -= 1
    EndIf
    Next
    
    Sleep(1000)

Until $running = 0

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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.