Posts: 1941
Score: 30
Joined: 6/29/2006
From: Orange County, California
Status: offline
Frequently Asked Stuff - Updated 04/24/2008
Just posting links or code to various questions I have seen members ask...will try to update often.
Why bother with this when people can Search like we often recommend members to do? Well, because if you're new you probably don't know the keywords to search for and if you do...you may not find it even though you remember seeing it.
TIP: Running your script using cscript.exe in conjunction with WScript.Echo is a great way to debug you code and ensure you are getting/setting the values you want.
Active Directory Browsing 1. Active Directory Explorer is similar to ADSI; you can see the objects properties by simply selecting it; date/time values are converted for easy reading as well. http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx
Add current date to file name; How do I format the current date to include it in the file name? 1. This could be one way to achieve this...
Directory; get subdirectories using WMI where folders contain characters such as { } ' 1. To get around this you need to use a pair of double quotes instead of single when specifying the directory name and use two \\ instead of one. See the example below.
Dynamic Constant; set a constant at time of execution I know this is a contradiction...but DiGiTAL.SkReAM shows a way of accomplishing this using ExecuteGlobal ...especially since he knows how ebgreen feels about this "hack" 1. http://www.visualbasicscript.com/m_46780/tm.htm
Read a File Into an Array 1.ehvbs posted a method here: http://www.visualbasicscript.com/m_47020/tm.htm 2. A simple method... NOTE: This method does not take into consideration any unnecessary blank spaces at the end of you file so you may get empty array elements!
3. Read a File to an Array using Regular Expressions to remove preceeding/trailing blank lines
How can I find a computer a user is logged into? Find logged in user. The short answer is there is no easy way to get this info. See the link below for a discussion on this same question. 1.http://www.visualbasicscript.com/m_42096/mpage_1/tm.htm
How can I force my script to run in CScript? 1. Based off a post by mbouchard.
How can I pause an HTA? What can I use in an HTA instead of WScript.Sleep? There are a few things you can try an use. 1. window.setInterval("FunctionorSubName", 1000) ' the 1000 is 1 second 2. window.setTimeout("FunctionorSubName", 1000) 3. Another method would be to create a Sub to pause for us.
4. Another method would be to call an external .vbs file that takes as an argument the sleep time
Why doesn't this objShell.Run "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" work?? Well the reason for this is the empty spaces in the path. A solution is to add the additional quotes. 1.EBGreen posted a function similar to the one below that works great.
2. You could also use double quotes, but that can start getting confusing