gunsmokingman Posted February 6, 2013 Share Posted February 6, 2013 TestDim Act :Set Act = CreateObject("Wscript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Fso.CopyFile "New offerte.doc", "H:\",TrueAct.Run(chr(34) & "New offerte.doc"& Chr(34)),Falsecopies without any errorbut needs Double Quotes to open, Chr(34)="1:\So the letter are for folders2:\ You want to copy those files to the User Input Letter FolderUpdated Script, it will make the UserInput Letter Folder On Drive H, which youcan change to suit your needs, then copies the 2 files.'-> 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.'-> Run Time ObjectsDim Act :Set Act = CreateObject("Wscript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> Runtime VariblesDim F, Fld'-> Check To Make Both Files ExistsIf Fso.FileExists("offerte.doc") And Fso.FileExists("factuur.vbs") ThenGetFldLtr()ElseMsgBox "Error Missing the offerte.doc or factuur.vbs."WScript.Quit()End IfFunction GetFldLtr()'-> Loop To Keep Inputbox ActiveDo'-> Get Drive LetterFld = InputBox(_"Type In The Drive Letter You Want To Use" & vbCrLf & vbCrLf &_"To Close And Do Nothing, Type Exit Or Quit","","",6500,5500)'-> Quit Or Exit ScriptIf InStr(1,Fld,"exit",1) And Len(Fld) = 4 Or _InStr(1,Fld,"quit",1) And Len(Fld) = 4 ThenWScript.QuitEnd ifIf Not IsNumeric(Fld) And Len(Fld) = 1 ThenIf Fso.DriveExists("H:\") ThenDim P [img=http://www.msfn.org/board/public/style_emoticons/default/tongue.gif]="H:\"&FldIf Not Fso.FolderExists(P) Then Fso.CreateFolder(P)Set F=Fso.GetFile("offerte.doc")F.Copy P&"\"&F.Name,TrueSet F=Fso.GetFile("factuur.vbs")F.Copy P&"\"&F.Name,TrueExit DoElseMsgBox "Error This Drive H:\ Is Missing . Contact The" & vbCrLf & _"To Get The Correct Drive Letter",4128,"Error No Drive"WScript.QuitEnd IfEnd IfLoop Until Len(Fld) = 1000End Function Link to comment Share on other sites More sharing options...
oxb Posted February 6, 2013 Author Share Posted February 6, 2013 (edited) Cool very nice If you couldt please add to youre code a second inputbox where the user can put in the name of the folder that shouldt be created inside the first folder chosen?So first choose folder letter>(you aced that) > after that type in name of client >(inputbox) >save offerte.doc to the name of the client in a subfolder also named after the client?like folder J >folder John doe>john doe.doc< wich was offerte.doc.Factuur.vbs needs to be in the same folder no rename.After copy> creation the userinput.doc needs to be opened.Thank you for all youre work!I am very happy with the script Edited February 6, 2013 by oxb Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 6, 2013 Share Posted February 6, 2013 I will post a updated script with the changes later on. Link to comment Share on other sites More sharing options...
oxb Posted February 6, 2013 Author Share Posted February 6, 2013 I will post a updated script with the changes later on.Great thanx a bunch!Going to bed now hard days work tomorrow.Looking forward to test the code Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 7, 2013 Share Posted February 7, 2013 I have made a HTA for you to try it uses VBS scripting to do the work<!--February-06-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>UserInput MkDir</TITLE><HTA:APPLICATION ID="InMkDir"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="InMkDir"Icon="%SystemRoot%\explorer.exe"><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;Text-Align:Center;Vertical-Align:Top;}TD{Font-Size:8.25pt;Font-Weight:Bold;Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;Color:Black;}.Tbx{Font-Size:8.25pt;Font-Weight:Bold;Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;Color:Black;}BUTTON{Height:15pt;width:60pt;Cursor:Hand;Font:8.05pt;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;Margin-Top:15pt;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(475) :Hht = int(225)window.ResizeTo Wth, HhtMoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Run Time ObjectsDim Act :Set Act = CreateObject("Wscript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> RunTime VariblesDim F1, F2, F1a, F2a, Msg1, Tm1, Tm2Msg1=". The Textboxes Have Been Disable, Contact The " & _"System Admin To Get The Missing Files"F1a="offerte.doc"F2a="factuur.vbs"Function Window_OnLoad()'-> Check To Make Both Files ExistsCheckFile(F1a)CheckFile(F2a)If F1 = True And F2 = True ThenTx1.style.visibility = ""Tx1.style.color="#117711"Tx1.innerHTML = "Confirm " & F1a & " Confirm " & F2aElseIf F1 = True And F2 = False ThenDisableTextBoxes()Tx1.innerHTML = "Confirm " & F1a & " Missing " & F2a & Msg1ElseIf F1 = False And F2 = True ThenDisableTextBoxes()Tx1.innerHTML = "Missing " & F1a & " Confirm " & F2a & Msg1ElseIf F1 = False And F2 = False ThenDisableTextBoxes()Tx1.innerHTML = "Missing " & F1a & " Missing " & F2a & Msg1End IfEnd Function'-> Checks For FilesFunction CheckFile(F)If Fso.FileExists(F) And F=F1a Then F1 = TrueIf Fso.FileExists(F) And F=F2a Then F2 = TrueEnd Function'-> If Any File Is Missing Disable The TextBoxFunction DisableTextBoxes()Tx1.style.visibility = ""Tx1.style.Bottom = 35Tx1.style.Left = 40Tx1.style.width = 375Tx1.Align="Left"Tx1.style.color="#980000"In1.disabled = TrueIn2.disabled = TrueEnd Function'-> Process The Submit ButtonFunction MySubmit()Tx1.style.color="#980000"If Len(In1.value) = 1 And Len(In2.value) >= 3 ThenTx1.style.color="#117711" :Tx1.style.Bottom = 35Tx1.innerHTML = "Confirm, Processing Information<BR>" & _UCase(In1.value) & " " & In2.valueDisplay()ElseIf Len(In1.value) = 0 And Len(In2.value) = 0 ThenTx1.innerHTML = "Error, Fill In Both Textboxes"ElseIf Len(In1.value) = 1 And Len(In2.value) = 0 ThenTx1.innerHTML = "Error, Fill In Full Name"ElseIf Len(In1.value) = 1 And Len(In2.value) <= 3 ThenTx1.innerHTML = "Error, Full Name Less Then 3 Characters"ElseIf Len(In1.value) = 0 And Len(In2.value) >= 3 ThenTx1.innerHTML = "Error, Single Letter Missing"End IfEnd Function'-> Process The InformationFunction ProcessMySubmit()If Fso.DriveExists("H:\") Then'-> Make First Folder Then Copy offerte.docDim P [img=http://www.msfn.org/board/public/style_emoticons/default/tongue.gif]="H:\" & UCase(In1.value)If Not Fso.FolderExists(P) Then Fso.CreateFolder(P)Set F=Fso.GetFile(F1a)F.Copy P & "\" & F.Name,True'-> Make Second Folder Then Copy factuur.vbsP = P & "\" & In2.valueIf Not Fso.FolderExists(P) Then Fso.CreateFolder(P)Set F=Fso.GetFile(F2a)F.Copy P & "\" & F.Name,TrueEnd IfMsgDisplay()End Function'-> Time Dealy Then CloseFunction Display()Tm1=window.setTimeout("Process1()",5000,"VBScript")End FunctionFunction Process1()window.clearTimeout(Tm1)ProcessMySubmit()End Function'-> Time Dealy Then CloseFunction MsgDisplay()Tx1.style.color="#3377AD"Tx1.style.Bottom = 39Tx1.innerHTML = "Process Completed"Tm2=window.setTimeout("ProcessFinished()",5000,"VBScript")End FunctionFunction ProcessFinished()window.clearTimeout(Tm2)window.close()End Function</SCRIPT><BODY><!-- Folder Letter --><TABLE Border='1'><TD Style='Width:385;Text-Align:Left;'>Please Type In A Single Letter From A-Z</TD><TD Style=''><INPUT Type='TextBox' ID='In1' Class='Tbx' Size='1' MAXLENGTH='1'></TD></TABLE><!-- User Name --><TABLE Border='1'><TD Style='Width:325;Text-Align:Left;'>Type In Your Full Name</TD><TD Style=''><INPUT Type='TextBox' ID='In2' Class='Tbx' Size='35' MAXLENGTH='128'></TD></TABLE><BUTTON ID='Bn1' OnClick='MySubmit()'>Submit</BUTTON><BUTTON ID='Bn2' OnClick='window.close()'>Close</BUTTON><!-- For Positioning The Tx1 Div Small And Large Text<DIV Style='Width:275;'>Confirm offerte1.doc Confirm factuur.vbs.</DIV><DIV Style='Width:375;Margin-Top:22pt;Text-Align:Left;'>Missing offerte1.doc Confirm factuur.vbs. TheTextboxes Have Been Disable, Contact The System Admin ToGet The Missing Files</DIV>--><DIV ID='Tx1' Style='visibility:hidden;Position:Absolute;Bottom:49;Left:90;Width:275;'></DIV></BODY> Link to comment Share on other sites More sharing options...
bphlpt Posted February 7, 2013 Share Posted February 7, 2013 (edited) @oxb,This might be a dumb question, but, if I understand this, since the "outer" folder (A, B, C, ...) seems to always be the first letter of the Client name, why is it necessary to have the user enter both steps? I mean if you just have the user enter the Client name such as "Ajax", then the script should be able to easily figure out that the .doc file copies and edits are going to to happen in the "A\Ajax" folder, right? Or is that not actually the case? Leaving in both steps allows more flexibility, but if what I surmised is really the case, then automating it will eliminate possible "misfiling" mistakes.Cheers and Regards Edited February 7, 2013 by bphlpt Link to comment Share on other sites More sharing options...
oxb Posted February 7, 2013 Author Share Posted February 7, 2013 Wow man amazinglooks professional now!Im so pleased, wouldt have never come up with that kind of scripting,Will take a look this evening gotta go work now.Much kudo`s to you sir SUPER Link to comment Share on other sites More sharing options...
bphlpt Posted February 7, 2013 Share Posted February 7, 2013 @oxb,Please see my question above. (It was directed to you.)Cheers and Regards Link to comment Share on other sites More sharing options...
jaclaz Posted February 7, 2013 Share Posted February 7, 2013 (edited) UNneeded, but JFYI:@echo offSETLOCAL ENABLEEXTENSIONSCLS ::PUSHD network Path to be filled in laterECHO Geef alfabetische letter en druk op enter!CHOICE /C:abcdefghijklmnopqrstuvwxyz /N >NULSET /A CharNum= %errorlevel% + 96CMD /C EXIT /B %CharNum%SET "Char=%=ExitCodeAscii%"ECHO copy offerte.doc %Char% ^& copy factuur.vbs %Char% ^& cd %Char% ^& Set directory=%Char%More details:http://reboot.pro/topic/2986-yacbfc-dec2hexcmd-and-hex2deccmd/?p=136708jaclaz Edited February 7, 2013 by jaclaz Link to comment Share on other sites More sharing options...
oxb Posted February 7, 2013 Author Share Posted February 7, 2013 Hi jaclazSorry i didnt see youre post ,you are right it better to let the script find its way.Didnt know that was possible, again big Noob at scripting.But the script you provided is under dos, i like the vbs option better (look and feel)Still youre input is highly appriciated and the script is going in my scripts folder for maybe later use.Thank you for the effort and input.Going to test the vbscript Gunsmokingman provided Will check back later.Thanx Guys Link to comment Share on other sites More sharing options...
oxb Posted February 7, 2013 Author Share Posted February 7, 2013 (edited) GunsmokingmanI tried youre script and like it very much However there are 2 (for you ) small thingsThe offerte.doc needs to be in the same folder as factuur.vbs ex folder J >john doe >factuur.vbs+offerte.doc< wich needs to be renamed to> john doe.docThe situation now is J>offerte.doc > john doe > factuur.vbsThe offerte.doc shouldt be renamed after the user input > john doe .docAlso couldt you please edit script that after creation of john doe.doc it gets opened in word? I have been playing about with youre script (tried it myself) but i seem to mess up.Again thanx for youre effort EDIT Nevermind i tried and figured out myself how to do it.Thanx for all your hard work GunsmokemanThank you jaclazIf you ever need new carpet ill hop on a plane and install that for you Edited February 7, 2013 by oxb Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 7, 2013 Share Posted February 7, 2013 1:\ offerte.doc does this become User Input.doc, and it gets copy to User Letter \User Input Folder Namealong with the VBS script.2:\ Open The User Name.doc from User Letter \User Input Folder NameHere is the updated HTA, with changes to the copy, both files end up in the User Namefolder and the doc file is rename to the user input.<!--February-06-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>UserInput MkDir2</TITLE><HTA:APPLICATION ID="InMkDir2"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="InMkDir2"Icon="%SystemRoot%\explorer.exe"><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;Text-Align:Center;Vertical-Align:Top;}TD{Font-Size:8.25pt;Font-Weight:Bold;Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;Color:Black;}.Tbx{Font-Size:8.25pt;Font-Weight:Bold;Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;Color:Black;}BUTTON{Height:15pt;width:60pt;Cursor:Hand;Font:8.05pt;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;Margin-Top:15pt;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(475) :Hht = int(225)window.ResizeTo Wth, HhtMoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Run Time ObjectsDim Act :Set Act = CreateObject("Wscript.Shell")Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> RunTime VariblesDim F1, F2, F1a, F2a, Msg1, Tm1, UserDocMsg1=". The Textboxes Have Been Disable, Contact The " & _"System Admin To Get The Missing Files"F1a="offerte.doc"F2a="factuur.vbs"Function Window_OnLoad()'-> Check To Make Both Files ExistsCheckFile(F1a)CheckFile(F2a)If F1 = True And F2 = True ThenTx1.style.visibility = ""Tx1.style.color="#117711"Tx1.innerHTML = "Confirm " & F1a & " Confirm " & F2aElseIf F1 = True And F2 = False ThenDisableTextBoxes()Tx1.innerHTML = "Confirm " & F1a & " Missing " & F2a & Msg1ElseIf F1 = False And F2 = True ThenDisableTextBoxes()Tx1.innerHTML = "Missing " & F1a & " Confirm " & F2a & Msg1ElseIf F1 = False And F2 = False ThenDisableTextBoxes()Tx1.innerHTML = "Missing " & F1a & " Missing " & F2a & Msg1End IfEnd Function'-> Checks For FilesFunction CheckFile(F)If Fso.FileExists(F) And F=F1a Then F1 = TrueIf Fso.FileExists(F) And F=F2a Then F2 = TrueEnd Function'-> If Any File Is Missing Disable The TextBoxFunction DisableTextBoxes()Tx1.style.visibility = ""Tx1.style.Bottom = 35Tx1.style.Left = 40Tx1.style.width = 375Tx1.Align="Left"Tx1.style.color="#980000"In1.disabled = TrueIn2.disabled = TrueEnd Function'-> Process The Submit ButtonFunction MySubmit()Tx1.style.color="#980000"If Len(In1.value) = 1 And Len(In2.value) >= 3 ThenTx1.style.color="#117711" :Tx1.style.Bottom = 35Tx1.innerHTML = "Confirm, Processing Information<BR>" & _UCase(In1.value) & " " & In2.valueDisplay()ElseIf Len(In1.value) = 0 And Len(In2.value) = 0 ThenTx1.innerHTML = "Error, Fill In Both Textboxes"ElseIf Len(In1.value) = 1 And Len(In2.value) = 0 ThenTx1.innerHTML = "Error, Fill In Full Name"ElseIf Len(In1.value) = 1 And Len(In2.value) <= 3 ThenTx1.innerHTML = "Error, Full Name Less Then 3 Characters"ElseIf Len(In1.value) = 0 And Len(In2.value) >= 3 ThenTx1.innerHTML = "Error, Single Letter Missing"End IfEnd Function'-> Process The InformationFunction ProcessMySubmit()If Fso.DriveExists("H:\") Then'-> Make First FolderDim P [img=http://www.msfn.org/board/public/style_emoticons/default/tongue.gif]="H:\" & UCase(In1.value)If Not Fso.FolderExists(P) Then Fso.CreateFolder(P)'-> Make Second FolderP = P & "\" & In2.valueIf Not Fso.FolderExists(P) Then Fso.CreateFolder(P)'-> Copy Rename offerte.doc And Get The Path And New NameSet F=Fso.GetFile(F1a)UserDoc = P & "\" & Replace(F1a,Left(F1a,7),In2.value)F.Copy P & "\" & Replace(F1a,Left(F1a,7),In2.value),True'-> Copy factuur.vbsSet F=Fso.GetFile(F2a)F.Copy P & "\" & F.Name,TrueEnd IfMsgDisplay()End Function'-> Time Dealy Then CloseFunction Display()Tm1=window.setTimeout("Process1()",2000,"VBScript")End FunctionFunction Process1()window.clearTimeout(Tm1)ProcessMySubmit()End Function'-> Time Dealy Then CloseFunction MsgDisplay()Tx1.style.color="#3377AD"Tx1.style.Bottom = 39Tx1.style.Left = 30Tx1.style.width = 395Tx1.innerHTML = "Process Completed, Preparing To Open : " & In2.value & ".doc"Tm1=window.setTimeout("ProcessFinished()",3000,"VBScript")End FunctionFunction ProcessFinished()'-> Open User Input DocAct.Run(Chr(34) & UserDoc & Chr(34)),1,Falsewindow.clearTimeout(Tm1)window.close()End Function</SCRIPT><BODY><!-- Folder Letter --><TABLE Border='1'><TD Style='Width:385;Text-Align:Left;'>Please Type In A Single Letter From A-Z</TD><TD Style=''><INPUT Type='TextBox' ID='In1' Class='Tbx' Size='1' MAXLENGTH='1'></TD></TABLE><!-- User Name --><TABLE Border='1'><TD Style='Width:325;Text-Align:Left;'>Type In Your Full Name</TD><TD Style=''><INPUT Type='TextBox' ID='In2' Class='Tbx' Size='35' MAXLENGTH='128'></TD></TABLE><BUTTON ID='Bn1' OnClick='MySubmit()'>Submit</BUTTON><BUTTON ID='Bn2' OnClick='window.close()'>Close</BUTTON><!-- For Positioning The Tx1 Div Small And Large Text<DIV Style='Width:275;'>Confirm offerte1.doc Confirm factuur.vbs.</DIV><DIV Style='Width:375;Margin-Top:22pt;Text-Align:Left;'>Missing offerte1.doc Confirm factuur.vbs. TheTextboxes Have Been Disable, Contact The System Admin ToGet The Missing Files</DIV>--><DIV ID='Tx1' Style='visibility:hidden;Position:Absolute;Bottom:49;Left:90;Width:275;'></DIV></BODY> Link to comment Share on other sites More sharing options...
oxb Posted February 8, 2013 Author Share Posted February 8, 2013 This is what i came up with (copy paste) Some text changed to my langauge<!-- February-05-13 Hta And Script By Gunsmokingman Aka Jake1Eye--> <TITLE>Maak Offerte</TITLE> <HTA:APPLICATION ID="InMkDir" 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="InMkDir" Icon="%SystemRoot%\explorer.exe"><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; Text-Align:Center; Vertical-Align:Top; } TD { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black; } .Tbx { Font-Size:8.25pt; Font-Weight:Bold; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Color:Black; } BUTTON { Height:15pt; width:60pt; Cursor:Hand; Font:8.05pt; 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; Margin-Top:15pt; 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(475) :Hht = int(225) window.ResizeTo Wth, Hht MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))'-> Run Time Objects Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")'-> RunTime Varibles Dim F1, F2, F1a, F2a, Msg1, Tm1, Tm2 Msg1=". FOUT " & _ "VRAAG OSCAR HULP" F1a="offerte.doc" F2a="factuur.vbs" Function Window_OnLoad() '-> Check To Make Both Files Exists CheckFile(F1a) CheckFile(F2a) If F1 = True And F2 = True Then Tx1.style.visibility = "" Tx1.style.color="#117711" Tx1.innerHTML = "Confirm " & F1a & " Confirm " & F2a ElseIf F1 = True And F2 = False Then DisableTextBoxes() Tx1.innerHTML = "Confirm " & F1a & " Missing " & F2a & Msg1 ElseIf F1 = False And F2 = True Then DisableTextBoxes() Tx1.innerHTML = "Missing " & F1a & " Confirm " & F2a & Msg1 ElseIf F1 = False And F2 = False Then DisableTextBoxes() Tx1.innerHTML = "Missing " & F1a & " Missing " & F2a & Msg1 End If End Function'-> Checks For Files Function CheckFile(F) If Fso.FileExists(F) And F=F1a Then F1 = True If Fso.FileExists(F) And F=F2a Then F2 = True End Function'-> If Any File Is Missing Disable The TextBox Function DisableTextBoxes() Tx1.style.visibility = "" Tx1.style.Bottom = 35 Tx1.style.Left = 40 Tx1.style.width = 375 Tx1.Align="Left" Tx1.style.color="#980000" In1.disabled = True In2.disabled = True End Function'-> Process The Submit Button Function MySubmit() Tx1.style.color="#980000" If Len(In1.value) = 1 And Len(In2.value) >= 3 Then Tx1.style.color="#117711" :Tx1.style.Bottom = 35 Tx1.innerHTML = "Bevestigd, Bezig met Offerte<BR>" & _ " " & In2.value Display() ElseIf Len(In1.value) = 0 And Len(In2.value) = 0 Then Tx1.innerHTML = "Fout,Voer beide velden in!" ElseIf Len(In1.value) = 1 And Len(In2.value) = 0 Then Tx1.innerHTML = "Fout, Voer naam in!" ElseIf Len(In1.value) = 1 And Len(In2.value) <= 3 Then Tx1.innerHTML = "Fout, Naam minimaal 3 letters" ElseIf Len(In1.value) = 0 And Len(In2.value) >= 3 Then Tx1.innerHTML = "Fout, Voer alfabetische letter in!" End If End Function'-> Process The Information Function ProcessMySubmit() If Fso.DriveExists("D:\") Then'-> Make First Folder Then Copy offerte.doc Dim P ="D:\" & LCase(In1.value) If Not Fso.FolderExists(P) Then Fso.CreateFolder(P)'-> Make Second Folder Then Copy factuur.vbs P = P & "\" & In2.value If Not Fso.FolderExists(P) Then Fso.CreateFolder(P) Set F=Fso.GetFile(F2a) F.Copy P & "\" & F.Name,True Set F=Fso.Getfile(F1a) F.Copy P & "\" & In2.value & "_offerte.doc" Set oWord = CreateObject("Word.Application") set oDoc = oWord.Documents.Open (P & "\" & In2.value & "_offerte.doc") oWord.Visible = true End If MsgDisplay() End Function '-> Time Dealy Then Close Function Display() Tm1=window.setTimeout("Process1()",5000,"VBScript") End Function Function Process1() window.clearTimeout(Tm1) ProcessMySubmit() End Function'-> Time Dealy Then Close Function MsgDisplay() Tx1.style.color="#3377AD" Tx1.style.Bottom = 39 Tx1.innerHTML = "Offerte Klaar" Tm2=window.setTimeout("ProcessFinished()",2000,"VBScript") End Function Function ProcessFinished() window.clearTimeout(Tm2) window.close() End Function</SCRIPT><BODY><!-- Folder Letter --> <TABLE Border='1'><TD Style='Width:385;Text-Align:Left;'>Voer alfabetische letter in</TD><TD Style=''> <INPUT Type='TextBox' ID='In1' Class='Tbx' Size='1' MAXLENGTH='1'> </TD></TABLE><!-- User Name --> <TABLE Border='1'><TD Style='Width:325;Text-Align:Left;'> Naam klant</TD><TD Style=''> <INPUT Type='TextBox' ID='In2' Class='Tbx' Size='35' MAXLENGTH='128'> </TD></TABLE> <BUTTON ID='Bn1' OnClick='MySubmit()'>Start</BUTTON> <BUTTON ID='Bn2' OnClick='window.close()'>Sluiten</BUTTON><!-- For Positioning The Tx1 Div Small And Large Text <DIV Style='Width:275;'>Confirm offerte1.doc Confirm factuur.vbs. </DIV> <DIV Style='Width:375;Margin-Top:22pt;Text-Align:Left;'> Missing offerte1.doc Confirm factuur.vbs. The Textboxes Have Been Disable, Contact The System Admin To Get The Missing Files</DIV> --> <DIV ID='Tx1' Style='visibility:hidden;Position:Absolute; Bottom:49;Left:90;Width:275;'></DIV></BODY>Gunsmokingman added code tags Link to comment Share on other sites More sharing options...
submix8c Posted February 8, 2013 Share Posted February 8, 2013 (edited) @oxb - when you want to post "code" usesome code hereto keep from disturbing the code. Note that you now have an "emoticon" (smiley face) in your code. The way to do above "code" is[ code ]something[ /endcode ](remove the blanks inside brackets). edit - DOH!!! Was too quick with that (see jaclaz' below). Edited (remove strikethrough from it)...Aaand - OK, just got too used to manually doing"stuff"(senselessly of course, seeing as how that little icon works...) Edited February 8, 2013 by submix8c Link to comment Share on other sites More sharing options...
jaclaz Posted February 8, 2013 Share Posted February 8, 2013 (edited) The way to do above "code" is [ code ]something[ /endcode ] (remove the blanks inside brackets). Not really. It is [ code] and [ /code] (not [ /endcode]), and in practice you select what you want to insert in CODE tags, then click on the little icon senselessy representing "<>" which you find in "post" or "edit" mode.jaclaz Edited February 8, 2013 by jaclaz 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