Announcement

Collapse
No announcement yet.

User Support VBS Script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • User Support VBS Script

    Hello guys,
    I just tried to create a couple of scripts that would allow users to send me messages when they need computer help.
    Now, I am trying to get more than 2 variables from one script (input.vbs) to another one (output.vbs).
    The first one gets the user information, the second one sends it to an email address.
    My problem is that I can't seem to find a way to get more than one variable accross the scripts with several characters.

    input.vbs
    Code:
    Set objShell = CreateObject("Wscript.Shell")
    
    chrValue = InputBox("Username:")
    strCommandLine = "output.vbs " & chrValue
    
    
    objShell.Run(strCommandLine)
    output.vbs
    Code:
    Set objEmail = CreateObject("CDO.Message")
    chrValue = Wscript.Arguments.Item(0)
    
    
    
    objEmail.From = "[email protected]"
    objEmail.To = "[email protected]"
    objEmail.Subject = "Troubleshooting Ticket" 
    objEmail.Textbody = (chrValue)
    		
    objEmail.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objEmail.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
            "exchangeserver" 
    objEmail.Configuration.Fields.Item _
        ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objEmail.Configuration.Fields.Update
    objEmail.Send
    I got some of the code from the technet ms site, so any help would be greatly appreciated.

  • #2
    Re: User Support VBS Script

    Why don't you use FOR loop in the 2nd line of code in output.vbs

    ex:
    chrValue=""
    For i=0 to n
    chrValue = chrValue+Wscript.Arguments.Item(0)
    Next

    Comment


    • #3
      Re: User Support VBS Script

      Originally posted by thyagu
      Why don't you use FOR loop in the 2nd line of code in output.vbs

      ex:
      chrValue=""
      For i=0 to n
      chrValue = chrValue+Wscript.Arguments.Item(0)
      Next

      I've tried that, but probably I do not know how to use it properly.
      If i=0 to n, then I need to specify that also on input.vbs ?

      Thanks !

      Comment


      • #4
        Re: User Support VBS Script

        Get the count of Arguments passed

        set args = WScript.Arguments
        n= args.Count

        Hope this will solve your problem.........

        Comment


        • #5
          Re: User Support VBS Script

          i didnt got u want
          if you want user to input their problem manually instead of editing in vbscript i have edited script for you, in this its ask user to insert user name and thier problem hope u like it


          Set objMessage = CreateObject("CDO.Message")
          objMessage.Subject = InputBox("Username: ",strTitle)
          objMessage.From = "[email protected]"
          objMessage.To = "[email protected]"
          objMessage.TextBody = InputBox("what is your problem?",strTitle)

          objMessage.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2


          objMessage.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.abc.com" 'any mail server

          'Server port (typically 25)
          objMessage.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

          objMessage.Configuration.Fields.Update


          objMessage.Send

          Comment

          Working...
          X