mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Post a Message to Twitter with VBS

Author Message
atmclick

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 10/10/2007
  • Location: Chicago
  • Status: offline
Post a Message to Twitter with VBS Monday, March 01, 2010 9:49 AM (permalink)
0

'******************************************************************************************
'*  Scriptname: PostToTwitterSimple.vbs 
'*    TWITTER STATUS UPDATE 
'*    Brad Shultz  - crribs.com
'******************************************************************************************

strUsername = "username" 'Username 
strPassword = "password" 'Password
strMessage = "This is a test twitter update from a vbscript." 'Message for twitter

strTwitterXMLResponse = SendToTwitter(strMessage, strUsername, strPassword) 

MsgBox strTwitterXMLResponse, VbOkOnly, "TWITTER STATUS UPDATE" 'postback what you sent to twitter

Function SendToTwitter(strMessage, strUsername, strPassword) 
     Set objHTTP = CreateObject("Microsoft.XMLHTTP") 
          objHTTP.open "POST", "http://twitter.com/statuses/update.xml", false, strUsername, strPassword 
          objHTTP.send "status=" & strMessage 
          SendToTwitter = objHTTP.responseText 
     Set objHTTP = nothing 
End Function
My Homepage, Crribs.com - Scripting stuff, editor reviews, Task Scheduler script-related stuff.

http://alanshultz.com - My Dad's webpage.  He's a Chicago Real Estate Agent/Broker (the best- for real :)).

#1
    adanot

    • Total Posts : 13
    • Scores: 0
    • Reward points : 0
    • Joined: 3/1/2010
    • Status: offline
    Re:Post a Message to Twitter with VBS Thursday, April 01, 2010 2:56 AM (permalink)
    0
    Nice script, I added some I/O to make it less hard coded. Check it out:


         '******************************************************************************************

        '*  Scriptname: PostToTwitterSimple.vbs

        '*    TWITTER STATUS UPDATE

        '*    Brad Shultz  - crribs.com
        '*    I/0 added by Adam Nottingham

        '******************************************************************************************
     
        strUsername = UserInput("UserName:  ") 'prompts for username
        Wscript.Echo "  "
        strPassword = UserInput("Password: ") 'prompts for password
        Wscript.Echo "  "
        strMessage = UserInput("Enter Message: ") 'Message for twitter


        strTwitterXMLResponse = SendToTwitter(strMessage, strUsername, strPassword)


        MsgBox strTwitterXMLResponse, VbOkOnly, "TWITTER STATUS UPDATE" 'postback what you sent to twitter
       
        Function UserInput( myPrompt )

        ' Check if the script runs in CSCRIPT.EXE
        If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
            ' If so, use StdIn and StdOut
            WScript.StdOut.Write myPrompt & " "
            UserInput = WScript.StdIn.ReadLine
        Else
            ' If not, use InputBox( )
            UserInput = InputBox( myPrompt )
        End If
    End Function


        Function SendToTwitter(strMessage, strUsername, strPassword)

             Set objHTTP = CreateObject("Microsoft.XMLHTTP")

                  objHTTP.open "POST", "http://twitter.com/statuses/update.xml", false, strUsername, strPassword

                  objHTTP.send "status=" & strMessage

                  'SendToTwitter = objHTTP.responseText

             Set objHTTP = nothing

        End Function
    #2
      blksith0

      • Total Posts : 51
      • Scores: 0
      • Reward points : 0
      • Joined: 10/17/2008
      • Status: offline
      Re:Post a Message to Twitter with VBS Thursday, April 01, 2010 10:47 AM (permalink)
      0
      What is I/O?
      #3
        ebgreen

        • Total Posts : 8088
        • Scores: 95
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        Re:Post a Message to Twitter with VBS Thursday, April 01, 2010 10:51 AM (permalink)
        0
        Input/Output. In this case he is refering to the Inputboxes to get the User Name, Password, and the message rather than hard coding them.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.8
          mbt shoes www.wileywilson.com