Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
deea_printesa
Femeie
24 ani
Dolj
cauta Barbat
24 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [VBSCRIPT] Use InputBox in VBScript to Set Variables [VBS] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
'
Just copy/paste this in notepad, save as VBS and run to test:


' declare variables
Dim strDateStart
Dim strDateEnd

' ask for values via InputBox
strDateStart = InputBox("Please enter start date (format is dd.mm.yyyy):")
strDateEnd = InputBox("Please enter end date (format is dd.mm.yyyy):")

' if either of them is null or 0, end
If strDateStart = 0 Or strDateEnd = 0 Then
  MsgBox "You didn't enter start date or end date"
  Set session = Nothing
  WScript.Quit
End If

' the 2 lines below are from a SAP session VBS but show how the 2 date variables are used
'session.findById("wnd[0]/usr/ctxtBUDAT-LOW").text = strDateStart
'session.findById("wnd[0]/usr/ctxtBUDAT-HIGH").text = strDateEnd

'Set session = Nothing


_______________________________________


pus acum 4 ani
   
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
Condition if input is date or not:


' declare variables
Dim strDateStart
Dim strDateEnd

' if InputBox doesn't contain date, script will end
strDateStart = InputBox("Please enter start date (format is dd.mm.yyyy):", "Date")
    If Not isDate(strDateStart) Then
        MsgBox "Date wasn't entered in the correct format dd.mm.yyyy - exiting..."
        WScript.Quit
    Else

    strDateEnd = InputBox("Please enter end date (format is dd.mm.yyyy):", "Date")
        If Not isDate(strDateEnd) Then
            MsgBox "Date wasn't entered in the correct format dd.mm.yyyy - exiting..."
            WScript.Quit
        Else
        MsgBox strDateStart & " - " & strDateEnd
   
        End If
End If


_______________________________________


pus acum 4 ani
   
Pagini: 1  

Mergi la