Twitter DLL revisited

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
MrSwissCheese
Newbie
Posts: 2
Joined: Wed Mar 26, 2014 3:35 am

Twitter DLL revisited

Post by MrSwissCheese » Wed Mar 26, 2014 4:34 am

I've used Macro Scheduler for a number of things in the past and got a wild hair to try out some automated support replies using Macro Scheduler when I tripped across the TweetLib DLL that you have available on the Downloads page.

When I try to post a test message to my account, I recieve a return value of 22, which is the same as a previous poster received when the Twitter API changed. I was wondering if the TweetLib DLL was still working or if I'm screwing something up. I'm just trying to post a test message using the tweet.scp file that is included in the tweetlib.zip file with no modification.

From what I read in the documentation, I should get a message from Twitter to authorize the application. I've tried this both logged into Twitter and with Internet Explorer closed. This is running on a Windows 7 system that was originally running Internet Explorer 11, but I have downgraded to Internet Explorer 8.

Also meant to mention that I am running Macro Scheduler 14.1.01. I ahve not tried on a previous version.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Mar 26, 2014 10:50 am

Hi,

Turns out Twitter enforced SSL connections as of end of January.

I've updated the library to use HTTPS. This means OpenSSL needs to be installed. The readme file has been updated accordingly with a download link for the OpenSSL binaries.

Thanks for letting me know about this. Trouble is this isn't an oft used library and so we tend not to be up to date on Twitter's constant changes!

Anyway, download the updated version from:
http://www.mjtnet.com/software/tweetlib.zip?v1.2
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MrSwissCheese
Newbie
Posts: 2
Joined: Wed Mar 26, 2014 3:35 am

Post by MrSwissCheese » Wed Mar 26, 2014 4:07 pm

Looks like it fixed the issue that I was having. I cant imagine how difficult it would be to keep up with the API changes.

The next question I have is about what things can be done with the DLL. I saw in a previous post that if we preface the message with a d @username, we can send a direct message. Is there any way to attach a picture to a post, since Twitter hosts pictures at pics.twitter.com now? I'm looking at posting periodic ads / specials by picture since it would bypass the 140 character limit.

I was debating on whether it would be better to use this DLL or just create a standard MS script using the built in IE functions, and this might be one of those things that requires writing the full script.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 01, 2014 8:53 am

It can only send text statuses, but you can probably just send a link. How about save the photos to dropbox or similar and then include the link in the status.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Re: Twitter DLL revisited

Post by MadQuestion » Fri Mar 16, 2018 10:54 pm

I was able to make a script that used images to automate twitter and post hundreds of jokes with images to twitter all day every day in a random order. Was very rarely detected by the twitter algorythm... I did get detected a few times though and was asked to unlock my account by phone verification. Here is the script I wrote, it takes jokes from a .txt file (All One Liners) reads them into variables and then posts them to twitter randomly, it also chooses a random image from my images folder and posts the images too randomly choosing an image to post with the text status. You could prob do something like this to get images onto twitter. It had way more code included but the character limit meant I had to delete some to make it fit here. Hope you get the jist from the remaining code below

Code: Select all

//Tell Twitter Jokes All Day
Let>INPUT_PASSWORD=0
Let>INPUT_BROWSE=1
//Let>INPUT_TIMEOUT=1000
Input>JOKELIST,Provide Your .txt File Of 100 One Line Jokes Now!,PLACE .TXT FILE WITH JOKE ON EACH LINE DIR HERE
GoSub>READJOKES
SRT>READJOKES
ReadLn>%JOKELIST%,1,JOKE001
ReadLn>%JOKELIST%,2,JOKE002
ReadLn>%JOKELIST%,3,JOKE003
ReadLn>%JOKELIST%,4,JOKE004
ReadLn>%JOKELIST%,5,JOKE005
ReadLn>%JOKELIST%,6,JOKE006
ReadLn>%JOKELIST%,7,JOKE007
ReadLn>%JOKELIST%,8,JOKE008
ReadLn>%JOKELIST%,9,JOKE009
ReadLn>%JOKELIST%,10,JOKE010
Let>ACTIVEJOKE=%JOKE001%
END>READJOKES
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=0
Let>MSG_HEIGHT=900
Let>MSG_WIDTH=1000
Message>001. %JOKE001%%CRLF%002. %JOKE002%%CRLF%003. %JOKE003%%CRLF%004. %JOKE004%%CRLF%005. %JOKE005%%CRLF%006. %JOKE006%%CRLF%007. %JOKE007%%CRLF%008. %JOKE008%%CRLF%009. %JOKE009%%CRLF%010. %JOKE010%%
Input>FUNNYNAMELIST,Provide Your .txt File Of 100 Funny Names Now!,FUNNY NAME LIST .TXT GOES HERE
GoSub>READFUNNYNAMES
SRT>READFUNNYNAMES
ReadLn>%FUNNYNAMELIST%,1,FUNNYNAME001
ReadLn>%FUNNYNAMELIST%,2,FUNNYNAME002
ReadLn>%FUNNYNAMELIST%,3,FUNNYNAME003
ReadLn>%FUNNYNAMELIST%,4,FUNNYNAME004
ReadLn>%FUNNYNAMELIST%,5,FUNNYNAME005
ReadLn>%FUNNYNAMELIST%,6,FUNNYNAME006
ReadLn>%FUNNYNAMELIST%,7,FUNNYNAME007
ReadLn>%FUNNYNAMELIST%,8,FUNNYNAME008
ReadLn>%FUNNYNAMELIST%,9,FUNNYNAME009
ReadLn>%FUNNYNAMELIST%,10,FUNNYNAME010
Let>ACTIVEFUNNYNAME=%FUNNYNAME001%
END>READFUNNYNAMES
Message>1. %FUNNYNAME001%%CRLF%2. %FUNNYNAME002%%CRLF%3. %FUNNYNAME003%%CRLF%4. %FUNNYNAME004%%CRLF%5. %FUNNYNAME005%%CRLF%6. %FUNNYNAME006%%CRLF%7. %FUNNYNAME007%%CRLF%8. %FUNNYNAME008%%CRLF%9. %FUNNYNAME009%%CRLF%10. %FUNNYNAME010%
Input>HASHTAGLIST,Provide Your .txt File Of 100 #Hashtags Now!,HASH TAG LIST .TXT GOES HERE
GoSub>READHASHTAGS
SRT>READHASHTAGS
ReadLn>%HASHTAGLIST%,1,HASHTAG001
ReadLn>%HASHTAGLIST%,2,HASHTAG002
ReadLn>%HASHTAGLIST%,3,HASHTAG003
ReadLn>%HASHTAGLIST%,4,HASHTAG004
ReadLn>%HASHTAGLIST%,5,HASHTAG005
ReadLn>%HASHTAGLIST%,6,HASHTAG006
ReadLn>%HASHTAGLIST%,7,HASHTAG007
ReadLn>%HASHTAGLIST%,8,HASHTAG008
ReadLn>%HASHTAGLIST%,9,HASHTAG009
ReadLn>%HASHTAGLIST%,10,HASHTAG010
Let>ACTIVEHASHTAG=%HASHTAG001%
END>READHASHTAGS
Message>1. %HASHTAG001%%CRLF%2. %HASHTAG002%%CRLF%3. %HASHTAG003%%CRLF%4. %HASHTAG004%%CRLF%5. %HASHTAG005%%CRLF%6. %HASHTAG006%%CRLF%7. %HASHTAG007%%CRLF%8. %HASHTAG008%%CRLF%9. %HASHTAG009%%CRLF%10. %HASHTAG010%
Input>URLLIST,Provide Your .txt File Of 100 URL's Now!,Random URL LIST .TXT GOES HERE
GoSub>READURLS
SRT>READURLS
ReadLn>%URLLIST%,1,URL001
ReadLn>%URLLIST%,2,URL002
ReadLn>%URLLIST%,3,URL003
ReadLn>%URLLIST%,4,URL004
ReadLn>%URLLIST%,5,URL005
ReadLn>%URLLIST%,6,URL006
ReadLn>%URLLIST%,7,URL007
ReadLn>%URLLIST%,8,URL008
ReadLn>%URLLIST%,9,URL009
ReadLn>%URLLIST%,10,URL010
Let>ACTIVEURL=%URL001%
END>READURLS
Message>1. %URL001%%CRLF%2. %URL002%%CRLF%3. %URL003%%CRLF%4. %URL004%%CRLF%5. %URL005%%CRLF%6. %URL006%%CRLF%7. %URL007%%CRLF%8. %URL008%%CRLF%9. %URL009%%CRLF%10. %URL010%
GoSub>SETIMAGELOCATIONS
SRT>SETIMAGELOCATIONS
Let>IMAGE001LOCATION=C:\FUNNY JOKE IMAGES\Image_001
END>SETIMAGELOCATIONS
IfWindowOpen>Macro Scheduler Message
  CloseWindow>Macro Scheduler Message
Endif
SRT>IMAGECHANGER
Label>IMAGENUMBER0
Random>40,RANDOMIMAGENUMBER
GoTo>IMAGENUMBER%RANDOMIMAGENUMBER%
Label>IMAGENUMBER1
Let>ACTIVEIMAGELOCATION=%IMAGE001LOCATION%
GoTo>IMAGEHASCHANGEDUP
Label>IMAGENUMBER2
Let>ACTIVEIMAGELOCATION=%IMAGE002LOCATION%
Label>IMAGEHASCHANGEDUP
END>IMAGECHANGER
SRT>CHANGEJOKES
Label>LINENUMBER0
Random>10,LINENUMBER
GoTo>LINENUMBER%LINENUMBER%
Label>LINENUMBER1
Let>ACTIVEJOKE=%JOKE001%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER2
Let>ACTIVEJOKE=%JOKE002%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER3
Let>ACTIVEJOKE=%JOKE003%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER4
Let>ACTIVEJOKE=%JOKE004%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER5
Let>ACTIVEJOKE=%JOKE005%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER6
Let>ACTIVEJOKE=%JOKE006%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER7
Let>ACTIVEJOKE=%JOKE007%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER8
Let>ACTIVEJOKE=%JOKE008%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER9
Let>ACTIVEJOKE=%JOKE009%
GoTo>JOKEONYOUPOINT
Label>LINENUMBER10
Let>ACTIVEJOKE=%JOKE010%
Label>JOKEONYOUPOINT
END>CHANGEJOKES
SRT>CHANGEFUNNYNAMES
Label>FUNNYLINE0
Random>10,FUNNYNUMBER
GoTo>FUNNYLINE%FUNNYNUMBER%
Label>FUNNYLINE1
  Let>ACTIVEFUNNYNAME=%FUNNYNAME002%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE2
  Let>ACTIVEFUNNYNAME=%FUNNYNAME003%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE3
  Let>ACTIVEFUNNYNAME=%FUNNYNAME004%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE4
  Let>ACTIVEFUNNYNAME=%FUNNYNAME005%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE5
  Let>ACTIVEFUNNYNAME=%FUNNYNAME006%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE6
  Let>ACTIVEFUNNYNAME=%FUNNYNAME007%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE7
  Let>ACTIVEFUNNYNAME=%FUNNYNAME008%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE8
  Let>ACTIVEFUNNYNAME=%FUNNYNAME009%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE9
  Let>ACTIVEFUNNYNAME=%FUNNYNAME010%
  GoTo>NEWFUNNYNAMEPOINT
Label>FUNNYLINE10
  Let>ACTIVEFUNNYNAME=%FUNNYNAME011%
Label>NEWFUNNYNAMEPOINT
END>CHANGEFUNNYNAMES
SRT>CHANGEHASHTAG
Label>HASHTAGLINE0
Random>10,HASHERNUMBER
GoTo>HASHTAGLINE%HASHERNUMBER%
Label>HASHTAGLINE1
  Let>ACTIVEHASHTAG=%HASHTAG002%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE2
  Let>ACTIVEHASHTAG=%HASHTAG003%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE3
  Let>ACTIVEHASHTAG=%HASHTAG004%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE4
  Let>ACTIVEHASHTAG=%HASHTAG005%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE5
  Let>ACTIVEHASHTAG=%HASHTAG006%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE6
  Let>ACTIVEHASHTAG=%HASHTAG007%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE7
  Let>ACTIVEHASHTAG=%HASHTAG008%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE8
  Let>ACTIVEHASHTAG=%HASHTAG009%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE9
  Let>ACTIVEHASHTAG=%HASHTAG010%
  GoTo>NEWHASHTAGPOINT
Label>HASHTAGLINE10
  Let>ACTIVEHASHTAG=%HASHTAG011%
Label>NEWHASHTAGPOINT
If>ACTIVEHASHTAG=##EOF##
  Let>ACTIVEHASHTAG=#JokesOnTwitter
Endif
END>CHANGEHASHTAG

//Everything above this line perpares the Var for the post

//Everything below this line is the code for the posting to twitter

//Images are not supplied

SRT>RUNURLTESTER
Label>RESTARTJOKER
GetTime>NOWTIME
GetDate>NOWDATE
Random>1000,JOKENUMBER
GoSub>CHANGEJOKES
GoSub>CHANGEFUNNYNAMES
GoSub>CHANGEHASHTAG
GoSub>CHANGEURL
GoSub>IMAGECHANGER
Random>1000,PROBABILITY
If>PROBABILITY<600
  GoTo>RESTARTJOKER
Endif
Random>1000,PROBABILITY
If>PROBABILITY>100
  GoTo>RESTARTJOKER
Endif
//Find and Left Click Middle Right of 
FindImagePos>%BMP_DIR%\image_8.bmp,SCREEN,0.7,8,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  Wait>2
Endif
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_9.bmp,SCREEN,0.8,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  Wait>1
Endif
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_1.bmp,WINDOW:(*) Twitter - Mozilla Firefox,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>WSI_TIMEOUT=10
  //Wait for 
  WaitScreenImage>%BMP_DIR%\image_2.bmp,0.6,CCOEFF
  If>WSI_TIMEDOUT=TRUE
    GoTo>RESTARTJOKER
  Endif
  //Find and Left Click Center of 
  FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0.6,1,XArr,YArr,NumFound,CCOEFF
  If>NumFound>0
    MouseMove>XArr_0,YArr_0
    LClick
    Wait>0.1
    Let>SK_DELAY=10
    SendText>Number %JOKENUMBER% This Joke Is For %ACTIVEFUNNYNAME%! @Handle %ACTIVEJOKE% %ACTIVEHASHTAG% %NOWTIME% %NOWDATE% %ACTIVEURL%
    //Find and Left Click Middle Right of 
    FindImagePos>%BMP_DIR%\image_4.bmp,SCREEN,0.7,8,XArr,YArr,NumFound,CCOEFF
    If>NumFound>0
      MouseMove>XArr_0,YArr_0
      LClick
      Wait>1
      Send>%ACTIVEIMAGELOCATION%
      Wait>1
      Press Enter
      Wait>1
      //Find and Left Click Bottom Left of 
      FindImagePos>%BMP_DIR%\image_7.bmp,SCREEN,0.7,3,XArr,YArr,NumFound,CCOEFF
      If>NumFound>0
        MouseMove>XArr_0,YArr_0
        LClick
        Wait>1
      Endif
    Endif
    GoSub>IMAGECHANGER
    //Find and Left Click Middle Right of 
    FindImagePos>%BMP_DIR%\image_3.bmp,WINDOW:(*) Twitter - Mozilla Firefox,0.7,8,XArr,YArr,NumFound,CCOEFF
    If>NumFound>0
      MouseMove>XArr_0,YArr_0
      LClick
      Label>KEEPWAITING
      Wait>2
      //Find and Left Click Center of 
      FindImagePos>%BMP_DIR%\image_6.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
      If>NumFound>0
        MouseMove>XArr_0,YArr_0
        LClick
        GoTo>KEEPWAITING
      Else>NumFound=0
        GoTo>SKIPREFRESH
      Endif
      MouseMove>86,52
      LClick
      Wait>5
      Label>SKIPREFRESH
      //Find and Left Click Middle Right of 
      FindImagePos>%BMP_DIR%\image_5.bmp,SCREEN,0.7,8,XArr,YArr,NumFound,CCOEFF
      If>NumFound>0
        MouseMove>XArr_0,YArr_0
        LClick
        Wait>5
      Endif
      GoTo>RESTARTJOKER
    Endif
  Endif
Else>NumFound=0
  Wait>1
Endif
GoTo>RESTARTJOKER
END>RUNURLTESTER
SRT>CHANGEURL
  Label>URLLINE0
  Random>10,URLNUMBER
  GoTo>URLLINE%URLNUMBER%
  Label>URLLINE1
  Let>ACTIVEURL=%URL002%
  GoTo>URLONYOUPOINT
  Label>URLLINE2
  Let>ACTIVEURL=%URL003%
  GoTo>URLONYOUPOINT
  Label>URLLINE3
  Let>ACTIVEURL=%URL004%
  GoTo>URLONYOUPOINT
  Label>URLLINE4
  Let>ACTIVEURL=%URL005%
  GoTo>URLONYOUPOINT
  Label>URLLINE5
  Let>ACTIVEURL=%URL006%
  GoTo>URLONYOUPOINT
  Label>URLLINE6
  Let>ACTIVEURL=%URL007%
  GoTo>URLONYOUPOINT
  Label>URLLINE7
  Let>ACTIVEURL=%URL008%
  GoTo>URLONYOUPOINT
  Label>URLLINE8
  Let>ACTIVEURL=%URL009%
  GoTo>URLONYOUPOINT
  Label>URLLINE9
  Let>ACTIVEURL=%URL010%
  GoTo>URLONYOUPOINT
  Label>URLLINE10
  Let>ACTIVEURL=%URL011%
  Label>URLONYOUPOINT
  If>ACTIVEURL=##EOF##
    Let>ACTIVEURL=www.artificial-media.myshopify.com
  Endif
END>CHANGEURL

GoSub>RUNURLTESTER
Hope this helps :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts