Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

gunsmokingman

Super Moderator
  • Content Count

    2,294
  • Joined

  • Last visited

  • Donations

    $0.00 

Everything posted by gunsmokingman

  1. I have updated the original HTA. 1:\ Made it so it runs command and other resources from a folder called Resource, I also included a icon for the HTA. In the resource folder there are 5 CMD files that are just examples to run upon selection 2:\ It self closes upon completion of command <TITLE>&#160;&#171;&#160;Windows 10 Install &#160;&#187;&#160;</TITLE> <HTA:APPLICATION ID="Win10Install" APPLICATIONNAME="Win10_Install" Border="Thin" BORDERSTYLE ="Complex" Caption="Yes" Icon="Resource/AppIcon01.ico" INNERBORDER ="No" Ma
  2. I do not know if you could use this. Here is a HTA I cobble together. It a HTA that uses VBS script to make it work. I added a text document named DemoInstall.hta.txt rename to DemoInstall.hta to make it active. I will help on any scripting problems you might have with this. <TITLE>&#160;&#171;&#160;Windows 10 Install &#160;&#187;&#160;</TITLE> <HTA:APPLICATION ID="Win10Install" APPLICATIONNAME="Win10_Install" Border="Thin" BORDERSTYLE ="Complex" Caption="Yes" Icon="%ProgramFiles%\Windows Media Player\wmplayer.exe" INNERBORDER ="No"
  3. This simple script is the VBS way of renaming a file using Drag And Drop and changing the file name to one with using HourMinuteSecond.FileExtension for it new name '-> Object To Copy And Delete File Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Run Time Varibles Dim FName, Nname '-> Check For Drag And Drop And Then Process A Single File If WScript.Arguments.Count = 1 Then '-> Get File So You Can Get It Path Set FName = Fso.GetFile(WScript.Arguments(0)) '-> File New Name Using HourMinutesSecomds.FileExtension Nname = Hour(Now) & Minute(N
  4. Here a demo menu cmd I made to turn on or @Echo Off CLS COLOR 9F MODE 62,9 TITLE Demo Menu :Main CLS Echo. Echo This Is To Turn On Or Turn Off The Hiberfil.sys Echo. Echo Type YES For This Choice Echo Type NO For This Choice Echo Type Quit To Close Window Echo. SET Choice= SET /P Choice=Type Choice Then Press Enter: IF /I '%Choice%'=='yes' GOTO Item1 IF /I '%Choice%'=='no' GOTO Item2 IF /I '%Choice%'=='quit' GOTO TheEnd ECHO "%Choice%" is not valid. Please try again. SET /P = Press Enter To Continue GOTO MAIN :Item1 CLS Echo. Echo You Selected Choice 1 ping -n 3 127.0.0.1&
  5. Cmd promt Echo www.google.com and open google.com Echo Off CLS Color 9F Mode 75, 17 Echo Opening www.google.com ping -n 2 127.0.0.1>nul start www.google.com ping -n 3 127.0.0.1>nul
  6. If you can use VBS here is a VBS script that checks all local active drives searching for a file called Test.txt. '-> Objects For Run Time Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Varibles For Run Time Dim Chk, Drv, Fil, Tmp '-> File Name To Search For Fil = "\Test.txt" '-> Check File Set To False If Found It Becomes True Chk = False '-> Loop For All The Drives For Each Drv In Fso.Drives '-> If Drive is Active If Drv.IsReady = True Then '-> Check For The File On A Active Drive
  7. Why not use VBS to do what you want. This way you do not have 3rd party apps to do what you want. If MsgBox("Would you like to restart the Computer?",4132,_ "Shut Off Computer") = 6 Then '-> Code Below Here Yes MsgBox "User said yes to restart" Else '-> Code Below Here No MsgBox "User said no to restart" End If
  8. To recap jaclaz all you have offer is nothing other than some apps that OP did not want to use. 1:\ The only way you might be able to do this is with VBS sendkeys method https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx This means, it might work or it might not work No where does it say it will work or that this is the only way of doing it. 2:\ I have given the OP a solution to his problem that he elected not to use
  9. You are wrong jaclaz Sendkeys does work on cmd.exe, I was able to send text and have it do a DIr command and exit.
  10. I did a test of cmd.exe using Sendkeys I did manage to get something to work. The problem is the loop for cmd.exe it just stays stuck in the loop. Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Act.Run("cmd.exe"),1,False Success = Act.AppActivate("cmd.exe") Wscript.Sleep 1000 Act.SendKeys "COLOR 9F" :WScript.Sleep 100 Act.SendKeys "{ENTER}" :WScript.Sleep 500 WScript.Sleep 100 Act.SendKeys "Test of AppActivate." :WScript.Sleep 1000 Act.SendKeys "{ENTER}" Act.SendKeys
  11. The SendKey method is not a very reliable way of doing things. The best way I think to do what Mike86 wants is use CreateObject("Wscript.Shell").run method and use it own built in method of displaying how the app windows appear. Table 3.9 Integers Accepted by the Run Method for the Window Style https://technet.microsoft.com/en-us/library/ee156605.aspx Integer = Window Style Description 0 = Hides the window and activates another window. 1 = Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size a
  12. Here is a SendKey Demo in VBS [CODE} Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Act.Run("Notepad.exe"),1,False Do Until Success = True Success = Act.AppActivate("Notepad") Wscript.Sleep 1000 Loop '-> Send keys Body Message Act.SendKeys "This is a test of AppActivate." WScript.Sleep 1000 Act.SendKeys "{ENTER}" Act.SendKeys "T" :WScript.Sleep 500 Act.SendKeys "e" :WScript.Sleep 500 Act.SendKeys "s" :WScript.Sleep 500 Act.SendKeys "t" :WScript.Sleep 500 '-&g
  13. Mike88 if you want a simple way to do what you want could you run the cmd from vbs Example [CODE} Dim Act :Set Act = CreateObject("Wscript.Shell") '-> First Cmd Show Windows Wait Until Finished Act.Run("Some1.cmd /Switches"),1,True '-> Second Cmd Hide Windows Wait Until Finished Act.Run("Some2.cmd /Switches"),0,True '-> Third Cmd Show Windows Wait Until Finished Act.Run("Some3.cmd /Switches"),1,True {/CODE] Table 3.9 Integers Accepted by the Run Method for the Window Style https://technet.microsoft.com/en-us/library/ee156605.aspx
  14. The only way you might be able to do this is with VBS sendkeys method https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx
  15. Start with a Google query like Code language for drivers https://www.google.ca/search?q=Code+langauge+for+Drivers&rlz=1C1CHBD_en-GBCA757CA757&oq=Code+langauge+for+Drivers&aqs=chrome..69i57.10342j0j8&sourceid=chrome&ie=UTF-8
  16. I am not sure what you want but using this reference https://msdn.microsoft.com/en-us/library/windows/desktop/aa378858(v=vs.85).aspx I put together this script run it and see if it what you need. Dim d,oWMI, oSR, colItem, objItem Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set oSR = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore") Set colItem = oWMI.ExecQuery("SELECT * FROM Win32_LogicalDisk WHERE DriveType=3") On Error Resume Next For Each objItem In colItem d = objItem.Name & "\" If (oSR.Enable(d))
  17. I have updated the original script 1:\ Added a message box to appear with instructions on how to use 2:\ Added a new user input to search for the file type New Code Dim Col,Str, Res :Str = "." Dim Wmi :Set Wmi = GetObject("winmgmts:\\" & Str & "\root\cimv2") '-> Check To Nake Sure Cscript Is Used If InStr(1,WScript.FullName,"cscript",1) Then UserImput() '-> Main Search Object Using The User Input Set Col = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = '" & Res &"'") WScript.StdOut.WriteLine "Begin Querry For " & Res Ma
  18. Here is a VBS script that output results to CMD prompt window. You will have to add the file type that you want to search for. '-> Main Search Object Change 'vbs' to 'FileTypeHere' Dim Col :Set Col = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'vbs'") Dim Str :Str = "." Dim Wmi :Set Wmi = GetObject("winmgmts:\\" & Str & "\root\cimv2") '-> Main Search Object Change 'vbs' to 'FileTypeHere' Dim Col :Set Col = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'vbs'") Dim Res '-> Check To Nake Sure Cscript Is Used If InStr(1,WScript.FullName,
  19. Here is a rewrite of your code that you posted, I removed all the redundant code and added a function to process the text file. <script language="VBScript"> Option Explicit '-> Objects For Run Time Dim fso :Set fso = CreateObject("Scripting.FileSystemObject") Dim WshShell :Set WshShell = CreateObject("WScript.Shell") Dim Temp :Temp = Temp = WshShell.ExpandEnvironmentStrings("%Temp%") '-> Varibles For Run Time Dim Command, PSFile, return, file,text '-> Button 01 Click Function Run_PS_Script1() ExampleOutput.value = "" btnClick1.disabled = True
  20. VBS Drag And Drop Function '-> Checks To Make Sure Only 1 Files Is Process If WScript.Arguments.Count = 0 Then MsgBox "You Must Drag And Drop One File Onto This Script.",4128, _ "Error No Drag And Drop performed" ElseIf WScript.Arguments.Count = 1 Then MsgBox WScript.Arguments.Item(0),4128, "Drag Drop Demo" ElseIf WScript.Arguments.Count > 1 Then MsgBox "Drag And Drop To Many Files, This Script Is Only For One File To Be Drag And Drop Onto " & _ "This Script",4128,"Error To Many Files" End If
  21. 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.
  22. 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
  23. 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 Di
  24. 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
  25. 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
×
×
  • Create New...