Jump to content


Photo

How to limit to run only 1 compiled bot instant at a time


  • Please log in to reply
15 replies to this topic

#1 Hung Le

Hung Le

    Member

  • UBot Users
  • PipPip
  • 25 posts
  • OS:Windows 7
  • Total Memory:2Gb
  • Framework:v4.0
  • License:Standard

Posted 22 February 2012 - 06:09 AM

Hello,
I am making a bot to auto commenting on forum. But I don't want user to have the ability to run multiple instant of bot at the same time, to keep them from abusing the bot and attract to much attention.
Right now, anyone can open multiple instant of compiled bot. Is there anyway to limit them to only able to run 1 instant of bot?
Thanks guys!

#2 LoWrIdErTJ - BotGuru

LoWrIdErTJ - BotGuru

    Botguru.net

  • Moderators
  • 3165 posts
  • LocationMichigan
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 22 February 2012 - 07:13 AM

you could write a file to a hidden area on the pc, that the bot is running, and have the bot check in teh beginning if it exists, and if so dont run.

but the bad side to this is that if they prematurely end the process of the bot, and the end part of the bot doesnt delete the file, then it could cause the next instance to not run.

Web Automation Bots @ BotGuru.net Want a Custom bot? click here or Email me
rjr.jpg

botgurusecured-banner.png

 


#3 odeesuba

odeesuba

    Advanced Member

  • UBot Users
  • PipPipPip
  • 140 posts
  • OS:Windows 7
  • Total Memory:4Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 22 February 2012 - 07:13 AM

Here is an idea...

At the start of the bot

If file exists

stop the bot

Else

write the file to hard disk


At the end of bot delete the file.

#4 JohnB

JohnB

    Advanced Member

  • UBot Users
  • PipPipPip
  • 3350 posts
  • LocationNJ
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 22 February 2012 - 09:13 AM

you could write a file to a hidden area on the pc, that the bot is running, and have the bot check in teh beginning if it exists, and if so dont run.

but the bad side to this is that if they prematurely end the process of the bot, and the end part of the bot doesnt delete the file, then it could cause the next instance to not run.


You could overcome this by adding a ui button that deletes the file and call it "reset" or something like that.


John




#5 rumen

rumen

    Advanced Member

  • UBot Users
  • PipPipPip
  • 57 posts
  • LocationBulgaria
  • OS:Windows 7
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Pro

Posted 22 February 2012 - 09:57 AM

Smarter way is to check and see how many processes yourexename.exe*32 is running via shell with VBscript on start up.Good news is You can limit how many bots can be run.VBscript can parse a list of processes in a text file and You can count the processes.If You have other questions for this way I will response tomorrow because of 1 post per day restriction of the forum.

#6 Hung Le

Hung Le

    Member

  • UBot Users
  • PipPip
  • 25 posts
  • OS:Windows 7
  • Total Memory:2Gb
  • Framework:v4.0
  • License:Standard

Posted 22 February 2012 - 10:11 AM

Smarter way is to check and see how many processes yourexename.exe*32 is running via shell with VBscript on start up.Good news is You can limit how many bots can be run.VBscript can parse a list of processes in a text file and You can count the processes.If You have other questions for this way I will response tomorrow because of 1 post per day restriction of the forum.

Thanks guys for all the ideas, that should give me something to work with!
I really interested in Rumen's solution, this sound cool! The bad news for me is I don't know VBscript. Looking forward to see it!

#7 a2mateit

a2mateit

    Advanced Member

  • UBot Users
  • PipPipPip
  • 1449 posts
  • OS:Windows Vista
  • Total Memory:3Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 22 February 2012 - 12:15 PM

Smarter way is to check and see how many processes yourexename.exe*32 is running via shell with VBscript on start up.Good news is You can limit how many bots can be run.VBscript can parse a list of processes in a text file and You can count the processes.If You have other questions for this way I will response tomorrow because of 1 post per day restriction of the forum.


Hey Rumen,

You should PM one of the Admin to get your one post a day restriction lifted...

#8 k1lv9h

k1lv9h

    Advanced Member

  • UBot Users
  • PipPipPip
  • 253 posts
  • LocationPennsylvania
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 23 February 2012 - 04:31 AM

You could do something like this:

set(#countforprogram, "cmd.exe", "Global")
gettaskcount()
define gettaskcount {
    set(#countforprogramfile, ".\\task-count-temp.dat", "Global")
    shell("cmd.exe /C tasklist | find /I /C \"{#countforprogram}\"  >\"{#countforprogramfile}\"")
    set(#taskcount, $read file(#countforprogramfile), "Global")
    shell("cmd.exe /C del \"{#countforprogramfile}\"")
}
if($comparison(#taskcount, ">=", 2)) {
    then {
        alert("Stopping. You have to many running. 
Current running count is: {#taskcount}")
        stop script
    }
    else {
        alert("Running. count is: {#taskcount}")
    }
}

Kevin

#9 JohnB

JohnB

    Advanced Member

  • UBot Users
  • PipPipPip
  • 3350 posts
  • LocationNJ
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 23 February 2012 - 06:47 AM

You could do something like this:

set(#countforprogram, "cmd.exe", "Global")
gettaskcount()
define gettaskcount {
    set(#countforprogramfile, ".\\task-count-temp.dat", "Global")
    shell("cmd.exe /C tasklist | find /I /C \"{#countforprogram}\"  >\"{#countforprogramfile}\"")
    set(#taskcount, $read file(#countforprogramfile), "Global")
    shell("cmd.exe /C del \"{#countforprogramfile}\"")
}
if($comparison(#taskcount, ">=", 2)) {
    then {
        alert("Stopping. You have to many running. 
Current running count is: {#taskcount}")
        stop script
    }
    else {
        alert("Running. count is: {#taskcount}")
    }
}

Kevin


Very nice. +1

John

#10 sforzando

sforzando

    Member

  • UBot Users
  • PipPip
  • 10 posts
  • OS:Windows 7
  • Total Memory:4Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 February 2012 - 02:10 AM

Thanks k1lv9h, works like a charm! +1

#11 Hung Le

Hung Le

    Member

  • UBot Users
  • PipPip
  • 25 posts
  • OS:Windows 7
  • Total Memory:2Gb
  • Framework:v4.0
  • License:Standard

Posted 24 February 2012 - 04:57 AM

Hell, can anyone help me, I only have standard edition of Ubot, and I dont understand the code. Can anyone explain it for me so I can apply with standard edition? This look so much simpler than my current method.

#12 k1lv9h

k1lv9h

    Advanced Member

  • UBot Users
  • PipPipPip
  • 253 posts
  • LocationPennsylvania
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 24 February 2012 - 05:26 AM

The bot.
Attached File  task-count.ubot   680bytes   40 downloads

Kevin

#13 Hung Le

Hung Le

    Member

  • UBot Users
  • PipPip
  • 25 posts
  • OS:Windows 7
  • Total Memory:2Gb
  • Framework:v4.0
  • License:Standard

Posted 24 February 2012 - 10:32 PM

Thanks a bunch, Kevin! +1

#14 Chainsaw

Chainsaw

    Advanced Member

  • UBot Users
  • PipPipPip
  • 155 posts
  • OS:Windows XP
  • Total Memory:1Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 26 February 2012 - 05:53 AM

Wow, very nice Kevin. Thanks for sharing the code, very useful.

#15 Bliss

Bliss

    Advanced Member

  • UBot Users
  • PipPipPip
  • 288 posts
  • LocationUK
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 10 March 2012 - 12:04 AM

Thanks for sharing with us.

Cheers Kevin

Jane

#16 satya17

satya17

    Member

  • UBot Users
  • PipPip
  • 18 posts
  • LocationIndonesia
  • OS:Windows 7
  • Total Memory:8Gb
  • Framework:v3.5 & v4.0
  • License:Dev

Posted 15 March 2012 - 08:49 PM

Thanks k1lv9h :D
+1

Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users