Content Type
Profiles
Forums
Events
Everything posted by gunsmokingman
-
Rename File Based on Date
gunsmokingman replied to andyasselin's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here is a VBS script that uses the move function to rename the file and add Day-Month-Year_ToFile.ext. '-> This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.'-> This is only posted as example code and meant only to used as such.'-> Handles Drag Drop Or Cmd Line Argument Select Case WScript.Arguments.Count Case 0 MsgBox vbTab & "Error No File" & vbCrLf & _ "You Must Drag And Drop One File On To" & vbCrLf & _ "This Script To Be Able Use This Script.",4128,"Error No File" Case 1 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Arg, Dy, Mh, NewFile, Yr Dy = Day(Now) :Mh =Month(Now) :Yr = Year(Now)'-> Add Zero Day And Month If Needed EG 1 = 01 If Len(Dy) = 1 Then Dy = "0" & Dy If Len(Mh) = 1 Then Mh = "0" & Mh Set Arg = Fso.GetFile(WScript.Arguments.Item(0)) NewFile = Fso.GetParentFolderName(Arg.Path) & "\" & Dy & "-" & Mh & "-" & Yr & "_" & Arg.Name If Not Fso.FileExists(NewFile) Then Fso.MoveFile WScript.Arguments.Item(0), NewFile Case Else MsgBox vbTab & "Error Exceeds One File" & vbCrLf & _ "This Script Requires Only One File To Be" & vbCrLf & _ "Drag And Drop. Files Drag And Drop Total : " & WScript.Arguments.Count _ ,4128,"Error To Many Files" End Select I tested the script using this cmd prompt script, I made sure both paths had an space in either path. I did not try the script with any special characters. @Echo OffCLSCOLOR F9Mode 75,7Echo.Echo Processing D:\boot.wimSet A1="C:\Users\Gunsmokingman\Desktop\Test One\DragDropAddDateForNewName.vbs"Set A2="D:\Test Folder\boot.wim"start "" /w %A1% %A2%pause -
Where should I start?
gunsmokingman replied to Torchizard's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here are 2 links with a bunch of C for beginner. Bing Programming Beginners C Google Programming Beginners C -
Ping utility GUI
gunsmokingman replied to stak1993's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
This is a HTA that demo how to use a function like a loop, it has some basic controls that stop, re start, re set, close. <!-- Hta And Script By Gunsmokingman Aka Jake1Eye This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use. This is only posted as example code and meant only to used as such.--><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 »</TD><TD><DIV ID='Tx1'>00 </DIV></TD></TD> <TD><TD>Minutes »</TD><TD><DIV ID='Tx2'>00</DIV></TD></TD> <TD><TD>Seconds »</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> -
Ping utility GUI
gunsmokingman replied to stak1993's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
1:\ Are you using server text? 2:\ Are you looking to make the script into GUI using HTA as the way to display the results. -
Hotfixes checklist for both versions of XP
gunsmokingman replied to ESCOMMODORE64's topic in Windows XP
I wrote a VBS and HTA that will list all the installed and missing updates, when active they seem like they are doing nothing but they are working and can take up to 5 minutes to finish. List Update Thread VBS script to list updates HTA to list updates -
Start programming?
gunsmokingman replied to huja's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
One semester of programming between 1983 - 1985 area. Joined this board about 10 years ago and saw how similar CMD was to I remember from my one semester of programming. I then started to learn CMD than moved onto VBS and now I am self taught in these code language's Jscript, HTA, Basic HTML, Vb.net -
Yzöwl excellent script. Here an modified script that I posted earlier, I made it remove all my VBS comments in my HTA for the demo. Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> File To Work WithDim Text :Text = "Demo Count Down.hta"'-> Check To See If File Exists If Fso.FileExists(Text) Then ReadListText(Fso.GetFile(Text)) Else WScript.Echo "Missing : " & Text End If '-> Function To Process Line By Line Text Files Function ReadListText(T) Dim i, j, Ts, V1 Set Ts = Fso.OpenTextFile(T.Path, 1) i = Ts.ReadAll For Each j In Split(i,vbCrLf)'-> Skips Comment Line For Output If Not Left(j,3) = "'->" Then WScript.Echo j End If Next End Function Here is the code in HTA to change <SCRIPT LANGUAGE='VBScript'>'-> Resize And Place In Approx Center Of Screen Dim Wth, Hht :Wth = int(401) :Hht = int(155) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Varibles For Runtime Dim S1, Tm1'-> Window Onload Function Window_OnLoad()'-> Set The Timer At 90 S1 = 90 Counter() End Function '-> Counter For Count Down Function Counter() If S1 = 0 Then'-> Code Here For Action When Timer Reaches Zero window.clearTimeout(Tm1) Tx1.innerHTML="000" ' CreateObject("Wscript.Shell").Run("shutdown.exe -s -f -t 00"),0,False CreateObject("Wscript.Shell").Run("shutdown.exe -r -f -t 01"),0,False window.close() End If'-> Add Zero To Count Down If Len(S1) = 1 Then S1 = "00" & S1 If Len(S1) = 2 Then S1 = "0" & S1 Tx1.style.color="#9A0000" :Tx1.innerHTML=S1 S1 = S1 - 1 Tm1=window.setTimeout("Counter()",1000,"VBScript") End Function </SCRIPT>Script output with comments removed <SCRIPT LANGUAGE='VBScript'> Dim Wth, Hht :Wth = int(401) :Hht = int(155) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2)) Dim S1, Tm1 Function Window_OnLoad() S1 = 90 Counter() End Function Function Counter() If S1 = 0 Then window.clearTimeout(Tm1) Tx1.innerHTML="000" ' CreateObject("Wscript.Shell").Run("shutdown.exe -s -f -t 00"),0,False CreateObject("Wscript.Shell").Run("shutdown.exe -r -f -t 01"),0,False window.close() End If If Len(S1) = 1 Then S1 = "00" & S1 If Len(S1) = 2 Then S1 = "0" & S1 Tx1.style.color="#9A0000" :Tx1.innerHTML=S1 S1 = S1 - 1 Tm1=window.setTimeout("Counter()",1000,"VBScript") End Function </SCRIPT>
-
If he was to post the full script that he is using I probably might post the VBS equivalent. Example VBS Script To Process A Text Line By Line Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> File To Work WithDim Text :Text = "Demo Count Down.hta"'-> Check To See If File Exists If Fso.FileExists(Text) Then ReadListText(Fso.GetFile(Text)) Else WScript.Echo "Missing : " & Text End If '-> Function To Process Line By Line Text Files Function ReadListText(T) Dim i, j, Ts Set Ts = Fso.OpenTextFile(T.Path, 1) i = Ts.ReadAll For Each j In Split(i,vbCrLf) WScript.Echo j Next End Function
-
Excel VBA (Procedure to Large)
gunsmokingman replied to drfb's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
I will look threw all the code and try to figure out some Arrays and some For If to lessen the code. Here is another code saving for you on the Msgbox, you are using a Variable to check for Yes Or No. Coded this way you will not need the variable because you will be using the Msgbox and using that result for your script. '-> Some Text Details About Purpose Of Messagebox If MsgBox( _ "Would You Like To Copy - Pay Rates",4132,"Payrates Copy") = 6 Then'-> Code Here For The Yes Reply Else'-> Code Here For The No Reply End IfHere is what using Array and a For Each Loop does for your code, all youwould have to is change all the WScript.Echo _ Example Of Changes for your script Change From WScript.Echo _ "wb2PR.Range(" & Chr(34) & i & Chr(34) & ").Copy" & vbCrLf & _ "wb3.Range(" & Chr(34) & j(0) & Chr(34) & ").PasteSpecial"Change To wb2PR.Range(Chr(34) & i & Chr(34)).Copy wb3.Range(Chr(34) & j(0) & Chr(34)).PasteSpecial'-> Pay Rate If MsgBox( _ "Would You Like To Copy - Pay Rates",4132,"Payrates Copy") = 6 Then Dim PyRts :PyRts = Array( _ "E1:F1", _ "B3:E3", _ "E5:F5", _ "B7:E7", _ "E9:F9", _ "B11:E11", _ "E13:F13", _ "B15:E15", _ "E17:F17", _ "B19:E19", _ "E21:F21", _ "B23:E23", _ "C26:C27", _ "C30:C31") Dim i, j '-> Loop Threw The Array For Each i In PyRts'-> Split i And Use First Value j = Split(i,":") WScript.Echo _ "wb2PR.Range(" & Chr(34) & i & Chr(34) & ").Copy" & vbCrLf & _ "wb3.Range(" & Chr(34) & j(0) & Chr(34) & ").PasteSpecial" If UCase(j(0)) = "C26" Then'-> EXTRA TAX #1 Date WScript.Echo _ "wb2PR.Range(" & Chr(34) & "E26" & Chr(34)& ").Copy" & vbCrLf & _ "wb3.Range(" & Chr(34) & "E26" & Chr(34)& ").PasteSpecial" End If If UCase(j(0)) = "C30" Then'-> EXTRA TAX #2 Date WScript.Echo _ "wb2PR.Range(" & Chr(34) & "E30" & Chr(34)& ").Copy" & vbCrLf & _ "wb3.Range(" & Chr(34) & "E30" & Chr(34)& ").PasteSpecial" End If Next'-> Primary ESO WScript.Echo _ "wb2PR.Range(" & Chr(34) & "O10" & Chr(34)& ").Copy" & vbCrLf & _ "wb3.Range(" & Chr(34) & "O10" & Chr(34)& ").PasteSpecial xlPasteValues" End If Produces this out put -
Excel VBA (Procedure to Large)
gunsmokingman replied to drfb's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Since I do not use Excel are you looking to clean up thing like Messageboxes and lessen the code. Example Your Msgbox Dim PR_YesNo Dim mboxPR As Integer Dim strPromptPR As String strPromptPR = "Do you want to copy - PAY RATES??" mboxPR = MsgBox(strPromptPR, vbYesNo, strTitle) Check pressed button If mboxPR = vbYes Then PR_YesNo = "YES" Else: PR_YesNo = "NO" End IfNow I am not sure if this will work in a Excel but here is a less coded Msgbox Dim PR_YesNo If MsgBox( _ "Would You Like To Copy - Pay Rates",4132,"Payrates Copy") = 6 Then PR_YesNo = "YES" Else PR_YesNo = "NO" End If -
Count down in a batch file
gunsmokingman replied to sixpack's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Since this is a older thread and the original poster requested Cmd with countdown, I just recently wrote this VBS script that has a countdown and you can cancel the countdown. '-> Object For Runtime Dim Act :Set Act = CreateObject("Wscript.Shell") '-> Set The Amout Of Time For Count Down Dim S1 :S1 = 15 Main() Function Main() If S1 = 0 Then '-> Script Action For Time Out MsgBox "Script Place Holder, Time Out",4128,"Demo CountDown" WScript.Quit End If '-> add Zero EG 9 = 009 If Len(S1) = 1 Then S1 = "00" & S1 If Len(S1) = 2 Then S1 = "0" & S1 '-> Time Message Box If Act.Popup( "Time Left : " & S1 & vbCrLf & _ "Press Cancel To Exit And Stop",1,"Test Count Down",4129) = 2 Then MsgBox "User cancel",4128,"User Cancel" WScript.Quit End If S1 = S1 - 1 Main() End Function -
To run the exe change to this '-> Code Here For Action When Timer Reaches Zero window.clearTimeout(Tm1) Tx1.innerHTML="000" CreateObject("Wscript.Shell").Run("shutdown.exe -s -f -t 00"),0,False window.close() Sound like you need to resize the HTA to fit any text changes that you may of made. This controls the size of the window so change it until it fits what you need. Wth=Width Hht=Height '-> Resize And Place In Approx Center Of Screen Dim Wth, Hht :Wth = int(401) :Hht = int(155)
-
Perhaps a HTA using VBS scripting would be better for what you want. I have made this HTA Demo of a count down, you can cancel the count down and close the HTA. <!--June-22-13 Hta And Script By Gunsmokingman Aka Jake1Eye This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use. This is only posted as example code and meant only to used as such.--><TITLE>Demo Count Down</TITLE><HTA:APPLICATION ID="D_C_Down"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="DCDown"Icon="%SystemRoot%\explorer.exe"><STYLE type="text/css">Body{Padding-Left:3pt;Padding-Right:3pt;Padding-Top:1pt;Padding-Bottom:1pt;Margin:1pt;Font-Size:9.25pt;Font-Weight:Bold;Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;Color:Black;BackGround-Color:#EFE9E3;Text-Align:Center;Vertical-Align:Top;}TD{Font-Size:9.25pt;Font-Weight:Bold;}BUTTON{Height:15pt;width:51pt;Cursor:Hand;Font:9.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 ScreenDim Wth, Hht :Wth = int(401) :Hht = int(155)window.ResizeTo Wth, HhtMoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Varibles For RuntimeDim S1, Tm1'-> Window OnloadFunction Window_OnLoad()'-> Set The Timer At 90S1 = 90Counter()End Function'-> Counter For Count DownFunction Counter()If S1 = 0 Then'-> Code Here For Action When Timer Reaches Zerowindow.clearTimeout(Tm1)Tx1.innerHTML="000"Exit FunctionEnd If'-> Add Zero To Count DownIf Len(S1) = 1 Then S1 = "00" & S1If Len(S1) = 2 Then S1 = "0" & S1Tx1.style.color="#9A0000" :Tx1.innerHTML=S1S1 = S1 - 1Tm1=window.setTimeout("Counter()",1000,"VBScript")End Function</SCRIPT><BODY><!-- Text Display --><P Style='Text-Align:Left;Margin-Bottom:1pt;Padding:3pt;'>When the timer reaches zero, it will then do some type of action. To Cancelpress the Close button to stop and close this window.</P><!-- Display The Count Down --><TABLE Style='Margin-Top:2pt;Margin-Bottom:3pt;'><TD><TD>Time Remaining »</TD><TD><DIV ID='Tx1'>000</DIV></TD></TD></TABLE><!-- Button Container --><TABLE><BUTTON ID='Bn1' OnClick="window.clearTimeout(Tm1): window.close()">Close</BUTTON></TABLE></BODY>
-
Software Install HTA
gunsmokingman replied to MadFly1's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Since I will not be doing your job, here is a hta that makes 20 checkboxes on a onload event. Each checkbox returns a simple message box, this is coded in Jscript but it will show how to add active checkboxes by script. <!-- Script By Gunsmokingman Aka Jake1eye June-14-2013 --> <TITLE>Script Make Checkboxes</TITLE> <STYLE type="text/css"> Body { Font-Size:9.25pt; Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black; BackGround-Color:#EFE9E3; Margin-Top:5; Margin-Bottom:5; Margin-Left:4; Margin-Right:4; Padding-Top:1; Padding-Bottom:1; Padding-Left:4; Padding-Right:4; Text-Align:Left; Vertical-Align:Top; Border-Top:0px Transparent; Border-Bottom:0px Transparent; Border-Left:0px Transparent; Border-Right:0px Transparent; } BUTTON { Height:13pt; width:65pt; Font:8.05pt; Font-weight:bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:#292929; Text-Align:Center; Vertical-Align:Middle; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#E5E5E5',EndColorStr='#7D7D7D'); Margin:1; Padding:1; Border-Left: 1px Transparent; Border-Right: 2px Transparent; Border-Top: 1px Transparent; Border-Bottom: 2px Transparent; } .HighLight { Font-Size:8.05pt; Font-weight:bold; Color:#000043; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='aliceblue',EndColorStr='#239595'); } .BLight { Font-Size:8.05pt; Font-weight:bold; Color:#411141; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#006363',EndColorStr='#BAEABA'); } TD { Font-Size:8.05pt; Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black; } TD.C1{Width:81PT;} TD.C2{Width:14PT;} </STYLE> <script LANGUAGE='JScript'> //-> Resize And Place In Approx center window.resizeTo(515,325) window.moveTo(screen.availWidth/2-(515/2),screen.availHeight/2-(325/2)) var c34=String.fromCharCode(34),C1=0,X1,Y1; //-> OnLoad window.onload=function(){CbxArea.style.visibility = "";MakeCheckBox();} //-> Make 20 Checkboxes 2 x 10 Colums function MakeCheckBox(){ X1=1;Y1=30; for(var i=0; i < 20; i++){ C1+=1; var Cbx ="<TABLE Style='Position:Absolute;Top:"+X1+"pt;Left:"+Y1+"pt;'>"+ "<TD OnMouseOver=';' OnMouseOut='' "+ "Class='C1'>Checkbox "+AZero(C1,2)+"</TD><TD Class='C2'>"+ "<Input Type='CheckBox' Name='CBX' ID='C_B_X_"+AZero(C1,2)+"'"+ " Value='Checkbox'"+AZero(C1,2)+" OnClick='alert("+c34+ "Checkbox "+AZero(C1,2)+c34+")'></Input></TD></TABLE>" X1=X1+20; /* */ if(C1==10 && C1 <=11){ChkAdd(Cbx);X1=1,Y1=145}else{ChkAdd(Cbx)} if(C1>=11){ChkAdd(Cbx)}}} //-> Build Checkboxes function ChkAdd(C){CbxArea.innerHTML = C+CbxArea.innerHTML;} //-> Add Zero To A Number function AZero(N,T){if(T==2){ //-> EG 1 = 01 if(N <= 9){N="0"+N} if(N == 10){N=N}} if(T==3){ //-> EG 1 = 001 if(N <= 9){N="0"+N} if(N == 10){N=N} if(N <= 99){N="0"+N} if(N == 100){N=N}} return N;} </SCRIPT> <BODY> <DIV ID='CbxArea' Style='Height:80pt;Width:352pt;visibility:hidden; Position:Absolute;Top:12;Left:12;'> </DIV> </BODY> -
Software Install HTA
gunsmokingman replied to MadFly1's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here is a better recursive script. I have it list all the files in a text file, the text file open automatically after the script has list all files. After you close the text file it will ask if you want to keep the file or delete the file. Demo Recursive List Script '-> Object For Run Time Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") '-> Variables For Run Time Dim Col, Ln, Obj, Ts, Tx Ln = "--------------------------------------------------------------" Tx = Act.SpecialFolders("Desktop") & "\ListFiles.txt" '-> Create Text File Set Ts = Fso.CreateTextFile(Tx) Ts.WriteLine " Time : " & Time() Ts.WriteLine " Date : " & Date() Ts.WriteLine Ln '-> Start The Listing Of All Files In All Sub Folders Recursive(Fso.GetFolder(".")) '-> Close Text File Ts.Close '-> Read The Text File Act.Run(Tx),1,True '-> Ask To Keep Or Delete File If MsgBox("Did you want to keep the text file", _ 4132,"Keep Or Delete") = 7 Then Fso.DeleteFile(Tx),True '-> Recursive Function Recursive(Folder) Ts.WriteLine " Folder Name : " & Folder Ts.WriteLine Ln '-> List Files In Folder For Each Obj In Folder. Files Ts.WriteLine " File Name : " & Obj.Name Ts.WriteLine " File Path : " & Obj.Path & vbCrLf Next '-> Goes Threw All Sub Folders In Parent Folder For Each Col In Folder.SubFolders Ts.WriteLine Ln Recursive(Col) Next End Function -
Your problem is this, the error means this is missing '------------------------------' Run Registry if needed'------------------------------Set regFile = "Genesis.reg"Here I redid the script so it a little more cleaner and added a FileExists check '-> This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.'-> This is only posted as example code and meant only to used as such.'-> Objects For RuntimeDim Act :Set Act = CreateObject("WScript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> ComputerNameDim CName :CName = Act.ExpandEnvironmentStrings("%ComputerName%")'MsgBox CName,4128,"Test Computer Name"Dim IS_RUN_REGISTRY'-> Check For RegistryHACIf UCase(Left(CName,3)) = "HAC" ThenIS_RUN_REGISTRY = TrueElseIS_RUN_REGISTRY = FalseEnd If'-> If IS_RUN_REGISTRY = True And The Reg File ExistsIf Fso.FileExists("Genesis.reg") And IS_RUN_REGISTRY Then' Act.Run("regedit.exe /s " & Chr(34) & "Genesis.reg" & Chr(34)), 0, TrueMsgBox "Confirm Reg File"ElseIf Fso.FileExists("Genesis.reg") And IS_RUN_REGISTRY = False ThenMsgBox "ComputerName match was False",4128,"No Match ComputerName"ElseMsgBox "Missing Genesis.reg please make sure it in the" & vbCrLf &_"Genesis.reg is in the same folder as this script",4128,"Missing Reg File"End If
-
echo command not work
gunsmokingman replied to faizan's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Maybe try it this way. Echo ^"Test >> Test.txt Tested 4 times and Produced Is this what you want it to do? -
Code to find files not in a list
gunsmokingman replied to a topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Are you trying to exclude certain updates from being installed? -
It does not delete, I just posted to show how it would be done in VBS and left the delete out. Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") If Not Fso.FileExists("Text1.txt") And _ Not Fso.FileExists("Text2.txt") Then '-> Code Here To Delete Or Do Something MsgBox "Delete Text3.txt" Else MsgBox "Text1 or Text2 Exists" End If Example VBS Delete to be added to above code Fso.DeleteFile("FILE_PATH\FILE_NAME"),True
-
A) It shows that while a Windows 8.1 version of SiB is not ready there is something that can be used as a placeholder... or perhaps useful for in another way it is a way to *Start* Application from *Desktop* B.) Who died and made you Boss ? @bphlpt ? As far as I can see you are Just a Member, like any other member and your post is just as off topic if not more... C) I would not say I post many off-topic things, I don't post too much at all, which also mean I would not cry a river if I would have to make new account D) Eat my shorts !!! How about I made bphlpt my extra eyes and ears, so maybe you should of listen. 1:\ This Thread is only for Start Is Back only 2:\ This Thread is not for any Microsoft alpha operating system 3:\ This Thread Is only for Start Is Back 4:\ This Thread is not about whining about admin decisions 5:\ This Thread is for Windows 8 and Start Is Back and not about, Start Is Back On Windows 9 Or Windows Blue and Start Is Back 6:\ Anyone posting any non relative stuff not about Windows 8 and Start Is Back will get one Level 3 warning, then if the same behavior continues you will be banned.