Bubblegum Bandit July 15, 2004 Share Bubblegum Bandit Member July 15, 2004 I have a script that I run on my server that dls the log files from the UT game servers, uploads them to the web server and then calls open IE with this string: C:\PROGRA~1\INTERN~1\IEXPLORE.EXE "www.urlhere.com" This url actually initializes a php script that parses the stats from the log files and generates the stats pages. My problem is, it doesn't close......so, if I were to go on vacation, say to fragfest it would run once and stay open, thus, not letting the scheduler run again until I manually shut it down. Is there either a line after this one I can put in, or some kind of addition to this string that will tell it to close when that url is done doing its thing? Link to comment Share on other sites More sharing options...
dwEEziL July 15, 2004 Share dwEEziL Member July 15, 2004 Does it leave the Dos box open when it is done? If so, try entering to a new line and adding "exit". Not for sure if this will work but it is worth a try. Link to comment Share on other sites More sharing options...
Bubblegum Bandit July 15, 2004 Author Share Bubblegum Bandit Member July 15, 2004 It leaves both the IE window open as well as the dos box open. I tried quit and exit and neither one worked. I'm assuming I need the command to tell IE to close because as soon as I x-out the IE window the DOS box closes itself. Link to comment Share on other sites More sharing options...
appalachian_fox July 15, 2004 Share appalachian_fox Member July 15, 2004 Yeah, the problem is with the DOS box is that it ends up handling the process it executes instead of handing it off to Windows and going about its own business. I put together something like this in a script a while ago, we don't use it anymore but let me look into this. It wasn't the same thing, but I might have a copy lying around I can get some ideas from. Link to comment Share on other sites More sharing options...
appalachian_fox July 15, 2004 Share appalachian_fox Member July 15, 2004 Okay, I'm not sure exactly how you're scripting this, but try the following command: start c:\progra~1\intern~1\iexplore.exe The start command hands off the process from the DOS box to the Windows environment. This will give you the command prompt back in the DOS box. Then you can try the exit command. Tell me more about this script, tho...Is it a batch file? Is it a Windows Script Host file? Is it all web-script with some odd command-line invoking voodoo? If this doesn't work I might could get you an answer tailored to your scripting method. Link to comment Share on other sites More sharing options...
Bubblegum Bandit July 15, 2004 Author Share Bubblegum Bandit Member July 15, 2004 I'll tell you what I can remember off hand.....if you need more I can post the actual script when I get home this evening. It is a bat file that is set up to run by windows scheduler. The first thing it does is delete all old logs from the log folder on my server. Then I run two WSFtp scripts that download the log files from each server. Then I have to run a putty script to ftp the logs onto our web server. Then I call the url that starts the log parsing. and then I'm stuck..... So my question with your "start" command is: If I do this, I understand that it will take me back to the dos prompt and I can say exit or quit or whatever to close dos.....So then next day that it runs, will it just open a new browser window? Because the way I see it, what you have said just closes the dos box, not the IE screen. Link to comment Share on other sites More sharing options...
appalachian_fox July 15, 2004 Share appalachian_fox Member July 15, 2004 (edited) Correct, this method only closes the DOS box. The IE window is still open. Does the server .php require the browser be closed each time? This will allow the windows scheduler to run the script every day, but if the web browser needs to be closed every day as well, that could cause some issues. If the browser needs to be closed every day, I wouldn't mind seeing the .bat file and the server .php script if you can PM me a copy of both or post them somewhere. Might give me some other ideas. Try this, though, and see if it works. *crosses fingers* Also, is this the last step in the chain? Is there something that has to happen afterwards? IF the log parsing is the last step you might could get away with just having a few IE windows open. It'll take some system resources but if it's just a few days you'll be alright. Perhaps a custom script can be written to trigger the .php without opening a web browser? Edited July 15, 2004 by appalachian_fox Link to comment Share on other sites More sharing options...
Bubblegum Bandit July 15, 2004 Author Share Bubblegum Bandit Member July 15, 2004 I will have to test it out to see if the browser has to be closed or not, I'm not sure. I'm gonna be gone for 10 days, so that's gonna make me have 10 browser windows open when I get home....LOL And yes, this is the last step in the chain, I was just trying to make everything disappear when it was done.....turns out I might need David Copperfield to help with that one.. Link to comment Share on other sites More sharing options...
random_n00b July 15, 2004 Share random_n00b Member July 15, 2004 You need a .pif file to tell DOS to close the window when the batch file is done. If you can't find a program to create one, just use my old Wolfenstein .pif file (link) and change the filename and paths to match your batch file (use right click -> properties on the .pif). The important part is that "Close on exit" is enabled on the Program tab. Link to comment Share on other sites More sharing options...
Bubblegum Bandit July 15, 2004 Author Share Bubblegum Bandit Member July 15, 2004 Okay, I'm not sure exactly how you're scripting this, but try the following command: start c:\progra~1\intern~1\iexplore.exe This works just as we had predicted, it closes the dos box which allows for the scheduler to run the bat file again, but it does open successive IE windows. Here are the scripts I'm running: mobostatdl.bat CD .. CD .. CD .. CD mobostatdl CD logs del *.log set PATH=F:\WSFTP;%PATH% ftpscrpt -f F:\mobostatdl\mobodl.scp set PATH=F:\WSFTP;%PATH% ftpscrpt -f F:\mobostatdl\cuffodl.scp set PATH=F:\WinSCP3\PuTTY;%PATH% pscp -pw xxxxxx f:\mobostatdl\logs\*.log gcadmin@www.gamerscoalition.com:/pub/web/gamrs.co/public/htmlgc/stats/mobocracy/utstats/logs START C:\PROGRA~1\INTERN~1\IEXPLORE.EXE "www.gamerscoalition.com/htmlgc/stats/mobocracy/utstats/logs.php?pass=logparse" EXIT mobodl.scp TRACE SCREEN LOG SCREEN USER mmmm PASS xxxxxx CONNECT 66.225.196.62 LCD F:\mobostatdl\logs\ CD userlogs MGET *.log MDELETE *.log CLOSE cuffodl.scp TRACE SCREEN LOG SCREEN USER leeut2k4cfg PASS xxxxxx CONNECT 66.208.104.128 LCD F:\mobostatdl\logs\ CD userlogs MGET *.log MDELETE *.log CLOSE All I really want to do is to be able to close the IE window when its done parsing, but I'm not sure how to do this.....I don't have the php file on my comp right now, I'll have to dl it if you want to see the code for it too. Link to comment Share on other sites More sharing options...
appalachian_fox July 16, 2004 Share appalachian_fox Member July 16, 2004 (edited) Noob, I like it. I'm not sure it will work with IE, though, since Explorer never actually finishes. It's slightly different from a DOS program in this aspect, but Bandit, I'd give it a try. You can replace iexplore.exe with update.pif, and set the .pif to close on exit. start.exe will run anything you have a file association for whether or not it is an executable. Another thing you can do, the half-Copperfield, is to run: start.exe c:\progra~1\intern~1\start.exe iexplore.exe /MIN this will run it minimized. That way, it'll still be open but not on the desktop. Another question...Does the .php file interact with the browser at all? Or does the browser simply trigger the .php file which runs on its own on the server with no browser input? It appears, since you are just navigating to the site, all you are doing is triggering the .php. I hate to make things more complicated, but it seems that with a proper session script you could use a telnet program to connect to your server at your desired .php page on port 80 and use something akin to a Method = "GET" routine to trigger it. The script you wrote would have to end the telnet session as well. However, this seems needlessly complex. I would look into a way to kill all processes named iexplore.exe every day, say, 5 minutes after the first script completes? You're not browsing the web on this computer, are you? If so, this might not be an option. -------EDIT----------- Here are two commands you can play with: tasklist and tskill. tasklist shows all the running tasks. tskill kills a running task. You might could slap something together with both of those commands to kill any instances of internet explorer open. Edited July 16, 2004 by appalachian_fox Link to comment Share on other sites More sharing options...
appalachian_fox July 16, 2004 Share appalachian_fox Member July 16, 2004 Okay, here's what I hacked up... tasklist /FI "IMAGENAME eq IEXPLORE.EXE" /FO CSV /NH Lists all tasks with the filter task = IEXPLORE.EXE in the format comma-separated values, without the header. This can be piped to a text file. From this you get the process name, PID, Session name, Session # and memory usage with a carriage return. The PID is the unique identifier that you can use with tskill tskill will kill any PID, so all you have to do is get the PID from the piped text file and send that to tskill. If you were very savvy, you could pipe the tasklist to a file, run another script that goes through the file and pulls out all the PIDs in the file and puts them in another file (it's easy to find, it's always the value between the first and second comma on each line, and the quotes can be sent to tskill also). Then you can run tskill on this PID-only file to kill all instances of Internet Explorer. Link to comment Share on other sites More sharing options...
Bubblegum Bandit July 16, 2004 Author Share Bubblegum Bandit Member July 16, 2004 Link to comment Share on other sites More sharing options...
[Mmmm]Homer July 16, 2004 Share [Mmmm]Homer Member July 16, 2004 a:\bootdisk run="FDISK" command="Delete Primary DOS partition" REBOOT That should work. Link to comment Share on other sites More sharing options...
appalachian_fox July 16, 2004 Share appalachian_fox Member July 16, 2004 Hehe, Windows wants to appeal to the UNIX user so much they throw a whole bunch of garbage command line functionality in a product they want to get out of the command line mentality altogether. *sigh* Link to comment Share on other sites More sharing options...
random_n00b July 17, 2004 Share random_n00b Member July 17, 2004 Heh, I noticed that using the "start" command releases IE from DOS's control, so a .pif file will do nothing. Anyhow, in mucking around with the code in my Proxomitron's popup blocker, I discovered that the javascript command open("close"); will close the current IE window with no prompts - just a "Windows Ding" sound and it's gone. If you have access to whatever file IE is loading, I'm sure you can figure out a way to put that to good use, such as in a 10 second timer that starts with the onLoad command. ...though I'm sure that appalachian_fox's method works very well too. It's just a little...complicated. Link to comment Share on other sites More sharing options...
appalachian_fox July 19, 2004 Share appalachian_fox Member July 19, 2004 No, n00b, it's not a little complicated...It's over-dramatically curse-word grade complicated. Go with n00b's answer. Far better. That's really nifty, n00b, thanks, I'll keep that one in mind. Link to comment Share on other sites More sharing options...
MC_Ranger July 19, 2004 Share MC_Ranger Member July 19, 2004 If you know how long IE needs to run (roughly), put a delay in the script with the Resource Kit utility SLEEP.EXE (if you don't already have it, download it from Microsoft or from here. Call the program from your BATCH file and then run the TASKKILL Windows XP/2003 DOS command. For example, to wait 5 minutes and then kill IE ---- SLEEP 300 TASKKILL /IM IEXPLORE.EXE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now