Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 00:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Loop and Incremente number in .exe

Discussion on Loop and Incremente number in .exe within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2015
Posts: 4
Received Thanks: 0
Loop and Incremente number in .exe

Hi !

I have 10 Firefox.exe (different Profiles), each one of them with the name:
Firefox_10.exe
Firefox_11.exe
Firefox_12.exe
Firefox_13.exe
Firefox_14.exe
Firefox_15.exe
Firefox_16.exe
Firefox_17.exe
Firefox_18.exe
Firefox_19.exe
Firefox_20.exe

I'm trying to do a script that search If Firefox_10 process exists, if YES, then open next Firefox... in this case Firefox_11 is the next Firefox, but it may happen Firefox_11 is also open, so loop till it finds a Firefox process that is not open and open it. The count starts at Firefox_10 and ends at Firefox_20, I don't want to close any process, just jump it and try to open next Firefox that is not open yet.

** Note: I need to open only one Firefox, the one that is free in numerical order, so if Firefox_10.exe is open and Firefox_13.exe is open, then the script should open Firefox_11.exe only and not Firefox_11.exe, Firefox_12.exe, etc..

I have then:

Code:
$start = 10
   While $start <= 20
     If Not ProcessExists("Firefox_"&$start&".exe") Then
       Run("C:\Users\admin\Desktop\OneDrive\SETTINGS\Firefox Stuff\Firefox Light\Mozilla Firefox 31.0\04_Ejecutables\Ejecutables\Firefox_"&$start&".exe")
       EndIf
$start += 1
   WEnd
So this script sucesfully search only for those Firefox that are not open yet and it open them all, that is the problem, I just need ONE firefox to open, not all the available ones.

Regards
frankhack1 is offline  
Old 01/07/2015, 03:55   #2
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
Exitloop in first found
YatoDev is offline  
Old 01/07/2015, 15:06   #3
 
elite*gold: 0
Join Date: Jan 2015
Posts: 4
Received Thanks: 0
Great! It did work, now I have another issue related to this.

After it finds and open only one Firefox (the one available in numerical order), I need to wait for 2 minutes since the Firefox have a lot of imacros files and it hangs when is firstly open, so that I have done it well, the issue is that I need that Firefox to be focus after the 2 min has passed. This is what I have tried:

Code:
$start = 10
   While $start <= 20

If Not ProcessExists("Firefox_"&$start&".exe") Then
       Run("C:\Users\admin\Desktop\Firefox_"&$start&".exe -no-remote -P Firefox_"&$start&" file:///C:/Users/admin/Desktop/OneDrive/SETTINGS/Paginas%20Falsas/blank.html")
Exitloop
MsgBox(0, "Title", "Firefox_"&$start&"", 1)

EndIf

$start += 1
   WEnd

Sleep(60000) ; <--- 1 minute
Sleep(60000) ; <--- 1 minute
AutoItSetOption('WinTitleMatchMode', 2)
$tbWin = 'Firefox_"&$start&"' ; ************ HERE THE ERROR: this $start variabla is not taken in count and cause of that, the Firefox that was opened is not getting focus **********
WinActivate($tbWin)
Sleep(1000)

Sleep(1000)
Send("!d")
ClipPut("imacros://run/?m=macros.js")
Send("^v")
Send("{ENTER}")
frankhack1 is offline  
Old 01/07/2015, 17:07   #4
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
WinTitleMatchMode is a bad idea in this case.

"Firefox_" & $start

And MsgBox(0, "Title", "Firefox_"&$start&"", 1) will be never reached
-> MsgBox(0, "Title", "Firefox_" & $start, 1) is enough
YatoDev is offline  
Old 01/08/2015, 13:03   #5
 
elite*gold: 0
Join Date: Jan 2015
Posts: 4
Received Thanks: 0
Hi !

"
WinTitleMatchMode is a bad idea in this case.

"Firefox_" & $start
"

I didn't get it, so WinTitleMatchMode is a bad idea in this case and this is the solution? "Firefox_" & $start ? so I should put ?

Code:
AutoItSetOption('WinTitleMatchMode', 2)
$tbWin = "Firefox_" & $start
WinActivate($tbWin)
frankhack1 is offline  
Old 01/08/2015, 14:38   #6
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
Quote:
Originally Posted by frankhack1 View Post
Hi !

"
WinTitleMatchMode is a bad idea in this case.

"Firefox_" & $start
"

I didn't get it, so WinTitleMatchMode is a bad idea in this case and this is the solution? "Firefox_" & $start ? so I should put ?

Code:
AutoItSetOption('WinTitleMatchMode', 2)
$tbWin = "Firefox_" & $start
WinActivate($tbWin)
$tbWin = "Firefox_" & $start
WinActivate($tbWin)

without wintitlematchmode
YatoDev is offline  
Old 01/09/2015, 01:25   #7
 
elite*gold: 0
Join Date: Jan 2015
Posts: 4
Received Thanks: 0
Great, it did work, thanks a lot!
frankhack1 is offline  
Reply


Similar Threads Similar Threads
(S)50€O2 Loop(B)25-50€Psc
11/08/2011 - Trading - 7 Replies
Topic, bitte schnell melden, brauche Guthaben
How to loop with db bot?
06/15/2011 - Silkroad Online - 0 Replies
Hi, i am trying to make the bot buy potions and go to the zone where my character farm ...i tried several times but nothing happens ...i mean i start recording,runing to the zone and saving the record after i got there but i get error.... (sry for my bad english)
sro-db bot loop bug!
09/29/2010 - SRO Private Server - 10 Replies
Hi. I have problem with looping in sro-db bot. Bot dont open any npcs! He just starts to talk and nothing more. When i click right option myself bot storage items, repair eq and buy pots then he goes to spot normally. I have to fix it but i dont know how. Please help me! :confused:
Agbot loop dosnt loop
10/18/2008 - Silkroad Online - 1 Replies
my agbot after i tele will go through the 20 sec wait then says in bot concle feature not available yet feature not available yet idk whats wrong



All times are GMT +2. The time now is 00:51.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.