View Full Version : Bat usage
juGGaKNot
14th December 2009, 12:15
Right now i'm using a small cli app ( nircmd ) to open a web page in the local browser, every time someone uses my bat the page is opened, so i can have some stats.
But the problem is someone can just refresh the page 10 times and the results are ...
How can i count the times the bat was used without the user seeing it ?
Cheers.
linyx
14th December 2009, 13:00
Are the stats stored in a text file (containing the number of times used)? Also, are they only using your batch file locally, or remotely too?
If it's local, then I imagine a little c++ program to add 1 to the number in the text file would suffice.
juGGaKNot
14th December 2009, 13:47
locally, no stats file now just a redirect to the website ( that has a counter ) after the encoding is done.
linyx
15th December 2009, 02:33
Here (http://www.mediafire.com/?0fzwxytonyc) is a C++ executable that will take a text file input from the commandline:
StatCounter.exe InputFile.txt
and add one to the number stored therein. If the file specified doesn't exist, it will say that it could not find the file, but it will create the file anyway, and set its value to 1.
I used the CodeBlocks IDE (Thanks to LoRd_MuldeR for that suggestion), and the GCC compiler.
Hopefully this is what you are looking for?
juGGaKNot
15th December 2009, 10:40
thnx for it but i think i messed up, i think i need it remotely ( this exe adds usage to the file.txt and updates it locally right ? )
something like :
Someone downloads my bat
they use it
In the bat i use a executable like so :
StatCounter.exe www.webpagewithcounter.com -silent ( for example )
And every time someone uses the bat the "StatCounter.exe" adds another click to the web page ( hidden web page with a counter )
This might be simple right ? this or 2 executable, one for who downloaded bat and one that i keep on my pc and receives data from the executable downloaded by others and counts the times used.
I hope you can understand my point now.
smok3
15th December 2009, 10:47
you could 1. make an empty text file someplace on your server, like on
myhost.com/mysoftwarev23/countmein.txt, then 2. in your bat something like:
wget myhost.com/mysoftwarev23/countmein.txt
3. check the server logs
or
write countmein.php counter which will log things and update the counter
p.s. from a user point of view 'calling home' is unwanted behavior btw.
juGGaKNot
15th December 2009, 11:18
i see, first method look great.
i will give it a try.
Gavino
15th December 2009, 11:53
What makes you think that someone running your bat file will be connected to the Internet at the time? Or (like me) they could be running a firewall that only allows certain programs to connect.
smok3
15th December 2009, 12:03
i'd test by pinging the actual server (replace google.com with your own host), something like
http://www.techimo.com/forum/networking-internet/73769-handy-batch-file-check-network-connectivity.html
juGGaKNot
15th December 2009, 12:12
What makes you think that someone running your bat file will be connected to the Internet at the time? Or (like me) they could be running a firewall that only allows certain programs to connect.
Good point, i just want to add it for some stats, it has been downloaded for 1300 times so far and i have seen about 100 movies made with it but i want real stats ..
i'd test by pinging the actual server (replace google.com with your own host), something like
http://www.techimo.com/forum/networking-internet/73769-handy-batch-file-check-network-connectivity.html
I e-mailed the maker of nircmd for some support, might find another way
now :
"%mypath%\bin\nircmdc.exe" urlshortcut "http://www.airwalk-media.com" "%mypath%\%mpath%" "AirWalk-Media"
"%mypath%\%mpath%\AirWalk-Media.url"
Works but i have to add some sort of -silent argh to the url open.
thnx for the help people.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.