gunsmokingman

Super Moderator
  • Content count

    2,257
  • Joined

  • Last visited

Community Reputation

20 Excellent

About gunsmokingman

  • Birthday 09/26/1962

Profile Information

  • OS
    none specified
  • Country

Recent Profile Visitors

1,124 profile views
  1. Here is a Demo VBS script that pings in this order, your computer, made up IP, your computer, made up IP. It uses a counter that resets it self every 5 times. When it stops if you do nothing or select No than the script continues after 30 seconds, if Yes is selected script quits. It displays the ping results in a 3 second self closing message box, it also display the cycles left before being ask to continue or quit. DemoPing '-> Run Time Object Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Run Time Varibles Dim C1, i, Ip, Rtn, T1, T2 Ip = Array("127.0.0.1", "81.123.55.99","127.0.0.2","82.234.100.56") '-> Loop To Keep Repeating The Second Loop Do C1 = C1 + 1 '-> Stops The Script If C1 = 5 Then '-> No Or Time Out Continues The Script, Yes Script Quit, If Act.Popup("Would You Like To Quit The Script?",30, _ "Continue Or Quit", 4132) = 6 Then WScript.Quit(1) End If '-> Reset The Counter C1 = 0 End If '-> Threw The Ip Array For Each i In Ip Ping(i) T1 = Rtn & ", Ip Reply : "& i :T2 = "Cycles Left : " & 5-C1 If Rtn Then Act.Popup T1 & vbCrLf & T2,3,"Yes Reply",4128 Else Act.Popup T1 & vbCrLf & T2,3,"No Reply",4128 End If Next Loop Until C1 = 10000 '-> Ping Computer Function Ping(P) If Act.Run("Ping -n 1 -w 1000 " & P, 0, True) = 0 Then Rtn = True Else Rtn = False End If End Function Rename PingDemo.vbs.txt to PingDemo.vbs to make it active PingDemo.vbs.txt
  2. You would need to use a loop within a loop to do what you need Example only not working code Do For Each Object In Your List Of Computors Some Code Here To Ping next Until Something That last 6 Hours
  3. Here is a VBS script that meant to be run from your Desktop to a Folder and list it Contents. It then rename the file to a 4 digit number, it also produces a text file with the changes made. 1:\ Change This For Each i In Fso.GetFolder("D:\UsbMp3").Files, to the path of the folder 2:\ This script only is meant to be used with file that have only 3 characters and a period any less or more will cause an error Code '-> Object For Runtime Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Run Time Varibles Dim C1, i, j, t, Ts '->Loop Threw The File In The Folder Listed Below For Each i In Fso.GetFolder("D:\UsbMp3").Files '-> Count The Files C1 = C1 + 1 '-> Get The Period And File Charaters EG .com, .txt, .vbs j = Right(i.Name,4) '-> For The Text Report List The New File Name With The Old File Name t = t & Az(C1) & j & " = " & i.Name & vbCrLf '-> Copy Old Name To the New Name = Az(C1) & j Fso.CopyFile i.Path,Replace(i.path,i.name,Az(C1) & j),True '-> Delete The Old File Fso.DeleteFile(i.Path),True Next '-> Build And Show The Report Set Ts = Fso.CreateTextFile("TestList.txt") Ts.WriteLine Now() Ts.WriteLine "Files Process : " & Az(C1) Ts.WriteLine t Ts.Close() Act.Run("TestList.txt"),1,True '-> Ask To Keep It Or Delete It If MsgBox("Yes To Keep TestList.txt Or No To Delete TestList.txt", _ 4132,"Keep Or Delete") = 7 Then Fso.DeleteFile("TestList.txt"),True End If '-> Funtion To Add Zero To The Number Function Az(n) Dim z If Len(n)= 1 Then n = "000" & n If Len(n)= 2 Then n = "00" & n If Len(n)= 3 Then n = "0" & n Az=n End Function Rename TestListFiles.vbs.txt to TestListFiles.vbs to make active TestListFiles.vbs.txt Resuts TestList.txt
  4. Perhaps a more simple solution would be to use a VBS script to install. I say this because VBS has a built in Timer Function, below is an example using 3 common MS apps in an Array. It will then process the time it takes you to close each app and report it with a 10 second self closing Popup messagebox. '-> Runtime Object Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Array To Hold Apps Dim App :App = Array("Notepad.exe","mspaint.exe", "cmd.exe") '-> Runtime Varibles Dim Tm1, Tm2, Tm3, Tm4, i '-> Threw Each App In Tha Array For Each i In App '-> Start Time Tm1 = Timer Act.Run(i),1,True '-> End Time Tm2 = Timer '-> Results Tm3 = Tm2 - Tm1 '-> For The Popup Report Tm4 = Tm4 & Round(Tm3,2) & " seconds " & i & vbCrLf Next '-> Show The Results Act.Popup Tm4,10,"Results",4128 Rename DemoTimer.vbs.txt to DemoTimer.vbs to make active DemoTimer.vbs.txt
  5. Here is a HTA that uses VBS script to create Demo Timer Here is the code for the HTA <!-- Script By Gunsmokingman Aka Jake1eye --> <TITLE>Demo Timer</TITLE> <HTA:APPLICATION ID="Demo Timer" SCROLL="No" SCROLLFLAT ="No" SingleInstance="Yes" ShowInTaskbar="No" SysMenu="No" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE ="complex" INNERBORDER ="No" Caption="Yes" WindowState="Normal" APPLICATIONNAME="DTimer" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { Padding-Top:1pt;Padding-Bottom:1pt;Margin:1pt; Font-Size:10.25pt;Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black;BackGround-Color:#EFE9E3; Text-Align:Center;Vertical-Align:Top; } DIV { Font-Size:10.25pt;Font-Weight:Bold;Color:#00A1A1; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; } TD { Font-Size:10.25pt;Font-Weight:Bold;Color:#515151; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; } BUTTON { Height:15pt;width:51pt;Cursor:Hand; Font:8.25pt;Font-weight:bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:#404040;Text-Align:Center;Vertical-Align:Middle; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#E5E5E5',EndColorStr='#7D7D7D'); Margin:1;Padding:2; Border-Left: 1px Transparent;Border-Right: 2px Transparent; Border-Top: 1px Transparent;Border-Bottom: 2px Transparent; } </STYLE> <SCRIPT LANGUAGE='VBScript'> '-> Resize And Place In Approx Center Of Screen Dim Wth, Hht :Wth = int(327) :Hht = int(150) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) Dim C1, H1, M1, T1, Tm1, txt Function Window_OnLoad() C1=0 :H1=0 :M1=0 Counter() End Function '-> To Keeps The Script In An Infinte Loop Until User Interaction Function Counter() '-> Reset The Seconds And Minutes Every 60 Cycles If C1 = 60 Then :M1 = M1 + 1 :C1 = 0 If M1 = 60 Then :H1 = H1 + 1 :M1 = 0 '-> To Display 02 Digits Ex 1 = 01 If Len(C1) = 1 Then C1 = "0" & C1 If Len(M1) = 1 Then M1 = "0" & M1 If Len(H1) = 1 Then H1 = "0" & H1 T1 = Split(Time(),":") If Len(T1(0)) = 1 Then T1(0) = "0" & T1(0) If Len(T1(1)) = 1 Then T1(1) = "0" & T1(1) Tx1.style.color="#9A0000" :Tx1.innerHTML=H1 Tx2.style.color="#009a00" :Tx2.innerHTML=M1 Tx3.style.color="#00009a" :Tx3.innerHTML=C1 Dim S :S = Split(T1(2), " ") If Len(S(0)) = 1 Then S(0) = "0" & S(0) Tx4.style.color="#009595" Tx4.innerHTML=T1(0) & ":" & T1(1) & ":" & S(0) & " " & S(1) C1 = C1 + 1 Tm1=window.setTimeout("Counter()",1000,"VBScript") End Function </SCRIPT> <BODY Scroll='No'><TABLE>Demo Timer</TABLE> <TABLE> <TD><TD>Hours&#160;&#187;</TD><TD><DIV ID='Tx1'>00 </DIV></TD></TD> <TD><TD>Minutes&#160;&#187;</TD><TD><DIV ID='Tx2'>00</DIV></TD></TD> <TD><TD>Seconds&#160;&#187;</TD><TD><DIV ID='Tx3'>00</DIV></TD></TD> </TABLE> <TABLE> <BUTTON ID='Bn1' OnClick="window.clearTimeout(Tm1)">Stop</BUTTON> <BUTTON ID='Bn2' OnClick="Counter()">Re-Start</BUTTON> <BUTTON ID='Bn3' OnClick="window.clearTimeout(Tm1): Window_OnLoad()">Re-Set</BUTTON> <BUTTON ID='Bn4' OnClick="window.clearTimeout(Tm1): window.close()">Close</BUTTON> </TABLE> <TABLE> <TD><DIV ID='Tx4'>00:00 PM</DIV></TD> </TABLE> </BODY> Demo_TimerCount.zip
  6. Here are some links for you to try and work out what you need done 1:\ Reading From and Writing to the Local Registry 2:\Changing Registry Data 3:\How Can I Create a New Registry Key
  7. You can use a VBS script to not show any windows Example '-> Constants For The Various Window States Const Hide = 0, Norm = 1, Min = 2, Max =3 '-> Object For Runtime Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Hidden Window And No Wait For The Script Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test && ping -n 3 127.0.0.1>nul"),0,False '-> Show The Normal Window And Wait For The Script To Finish ' Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test && ping -n 3 127.0.0.1>nul"),1,True
  8. Here is the results with 2 usb drives plug in to my computer, remove the .txt to make active. UsbDrive.vbs.txt
  9. Here is a simple VBS script that list Removable drives if they are connected. It will display the Drive Size, Free Space, Used Spaced. '-> Constant For GB Size Const GB = 1073741824 '-> Object For Runtime Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Varibles For Run Time Dim Drv, Dsk, Usb, vB :vB = vbTab '-> Loop Threw All Drives For Each Dsk In Fso.Drives If Dsk.IsReady Then '-> Drive Type Removable Or USB If Dsk.DriveType = 1 Then Usb = Usb &_ Dsk.DriveLetter & ":\ USB" & vB & "Size = " & Num(Dsk.TotalSize) & ", Free = " &_ Num(Dsk.FreeSpace) & ", Used = " & Num(Dsk.TotalSize - Dsk.FreeSpace) & vbCrLf End If End If Next '-> Function To Convert Numbers To GB Function Num(N) Num = Round(N/GB,2) If Num <= 10 Then Num = "0" & Num If Num > 0 And Num < 1 Then Num = "0" & Num End Function '-> Show The Results If Chk = True Then MsgBox vbTab & "Usb Drive Results" & vbCrLf & Usb, 4128,"Usb Querry" Else MsgBox "No Removable Drives Were Found",4128,"Usb Querry" End If
  10. Here is the VBS way of doing it with checks '-> Runtime Varibles Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Runtime Object Dim C1, C2, Tx1, Tx2,Ts '-> Check For Text File One If Fso.FileExists("Test1.txt") Then C1 = True Set Ts = Fso.OpenTextFile("Test1.txt") Tx1 = Ts.ReadAll Ts.Close End If '-> Check For Text File Two If Fso.FileExists("Test2.txt") Then C2 = True Set Ts = Fso.OpenTextFile("Test2.txt") Tx2 = Ts.ReadAll Ts.Close End If '-> If C1 And C2 Are true Than Make The Third Text File If C1 = True And C2 = True Then Set Ts = Fso.CreateTextFile("Test3.txt") Ts.WriteLine Tx1 & vbCrLf & Tx2 Ts.Close CreateObject("Wscript.Shell").run("Test3.txt") End If
  11. Perhaps a VBS script would be better suited to your needs, here is an example of looping threw all the non empty drives. '-> Object For RuntimeDim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Varibles For Run TimeDim Drv, Dsk'-> Loop Threw All Drives For Each Dsk In Fso.Drives If Dsk.IsReady Then'-> Drive Type Select Case Dsk.DriveType Case 0: Drv = "Unknown" Case 1: Drv = "Removable" Case 2: Drv = "Fixed" Case 3: Drv = "Network" Case 4: Drv = "CD-ROM" Case 5: Drv = "RAM Disk" End select WScript.Echo Dsk.DriveLetter & ":\ " & Drv End If Next
  12. Here is a new WMI Query that I hope is more to what you need. '-> WMI ObjectDim Wmi :Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")'-> Run Time VariblesDim Obj, Rpt'-> Wmi Query And Class Loop For Each Obj in Wmi.ExecQuery("SELECT * FROM Win32_DiskDrive")'-> Collect The Objects For The Wmi report Rpt = Rpt & "-----------------------------------" & vbCrLf & _ "Interface" &vbtab& Obj.InterfaceType & vbCrLf & _ "Model " &vbtab& Obj.Model & vbCrLf & _ "Name " & vbtab& Obj.Name & vbCrLf Next'-> Report The WMI Query MsgBox Space(10) & "WMI Disk Drive Report" & vbCrLf & Rpt,4120,"Result WMI"
  13. I believe in earlier versions of Wscript you needed to close the object created by using Obj = Nothing, but in newer version it is not needed.
  14. Short answer No, not that I know of.
  15. The reason I have not help is because it a WSH and using VBScript as the working engine. Plus there examples as to how the script should be used. Example of usage from the script. <example>fw-ip-search.wsf /search:"%136.165.238.%"</example><example>fw-ip-search.wsf /run:internet /search:"%136.165.238.%"</example><example>fw-dst_host-search.wsf/search:"%dmp-ll02-1%"</example><example>fw-dst_host-search.wsf/run:internet / search:"%dmp-ll02-1%"</example>