sysbuilder Posted July 5, 2007 Share Posted July 5, 2007 I need to configure windows xp sp2 to run a batch file automatically after logging in when in the docked state, and not in the undocked state.This batch file would run the following apps in order so that all desktop apps needed in the workday open automatically. Outlook (along with preferred order of outlook windows)OnenoteYahoo instant messengerWebex homepage (for daily reviw of meetings) Strike homepage (for weekly review of workflows) Documentation drive Siebel parts ordering site?Task manager, minimized to trayx amount of other minimal progsI would think I need to consider embedding timeouts between each app starting up so that they open in the order I prefer. What I'm looking for is the syntax this batch file would take; I've not written many so I imagine this is quite simple.Can someone provide me with some direction? The whole idea is to be able to dock my laptop at my desk, boot up, log in. I then go to get mail/coffee etc. Once I arrive back my apps are loaded and waiting on me. I know this sounds corny, but, I'm all about gtd and this would allow me to dive deeper into work quicker in the mornings.Certainly someone else has considered this. Any feedback would be phenominal.Thanks!!! Link to comment Share on other sites More sharing options...
[deXter] Posted July 5, 2007 Share Posted July 5, 2007 This script takes advantage of the fact that a different hardware profile is loaded when a laptop is docked. Assuming profile #2 is loaded in the docked state..@echo offsetlocalfor /f "Tokens=2*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB" /V CurrentConfig^|FIND "REG_DWORD"') do (set /a profile=%%b)if %profile%==1 goto undockedif %profile%==2 goto dockedgoto EOF:undockedecho Computer isn't docked.goto EOF:dockedecho Computer is docked. Launching programs...START SomeRandomProgram.exe:: Insert a 10 second delay : ping -n 10 127.0.0.1>NUL:: Starts Task Manager minimizedSTART /MIN taskmgr.exe:EOFendlocal • I suggest you head over to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\IDConfigDB and confirm the value of CurrentConfig when the laptop is docked and make any changes to the script (if necessary). • There is no direct Sleep or Delay function in batch, but we can use the ping command to create a delay. Note that it's off by one second, so PING -n 10 actually causes a delay of 9 seconds • You can use the START command to launch applications. Type START /? in the Command Prompt to find out more ways to launch apps. Link to comment Share on other sites More sharing options...
sysbuilder Posted July 6, 2007 Author Share Posted July 6, 2007 This is exactly what I needed!! Thank you!How would one include an instance of internet explorer with a particular page displayed (ie. my google calendar?)Thanks so much for the quick response! I'm testing the batch file periodically during the day.I will post my final custom batch file once I've completed it. Perhaps others can take advantage of this time saver.Does anyone think there's a better way to go about this than a simple batch file? This will work perfectly for me, however, I'm wondering what others have done when they needed a solution like this?Thanks for the read. Link to comment Share on other sites More sharing options...
[deXter] Posted July 6, 2007 Share Posted July 6, 2007 iexplore.exe "www.google.com".. or whatever page you want to open.Does anyone think there's a better way to go about this than a simple batch file?As such, there isn't any location where windows stores directly if a computer is docked or not. I guess the other way you can check for docking is to see if a particular hardware is present. If it is, then you'll know that the computer is docked. Link to comment Share on other sites More sharing options...
sysbuilder Posted July 6, 2007 Author Share Posted July 6, 2007 Great, thanks!How do have an instance of a mapped drive open as well?LOL this is routine stuff, I know. Thanks for the read. Link to comment Share on other sites More sharing options...
[deXter] Posted July 6, 2007 Share Posted July 6, 2007 explorer Z:Where Z: is your mapped drive Link to comment Share on other sites More sharing options...
sysbuilder Posted July 6, 2007 Author Share Posted July 6, 2007 Man, you're quick to respond.You must have email noti's setup when one responds.This is so sweet. It may not look like much, but, this allows me to hit the ground running every morning. Thanks so much for your assistance. I hope others find value in this thread. Link to comment Share on other sites More sharing options...
sysbuilder Posted July 11, 2007 Author Share Posted July 11, 2007 One more quick question:Is it possible to write something into the batch file that will refresh one of my ie pages at a predetermined interval?Thanks so much. Link to comment Share on other sites More sharing options...
[deXter] Posted July 12, 2007 Share Posted July 12, 2007 Well, you can create a VBS file that does that. If you want to call it from the batch file, just type its name Copy-Paste this into a notepad window and save as "Refresh.vbs" (Don't forget to include the quotes!)set WshShell = WScript.CreateObject("WScript.Shell")WshShell.AppActivate "Google - Windows Internet Explorer"WScript.Sleep 100WshShell.SendKeys "{F5}" 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