<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus' Macro Blog &#187; Web/Tech</title>
	<atom:link href="http://www.mjtnet.com/blog/category/webtech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mjtnet.com/blog</link>
	<description>Mostly tips, tutorials, articles and news about Macro Scheduler &#38; Windows Automation</description>
	<lastBuildDate>Fri, 03 Feb 2012 16:22:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions</title>
		<link>http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/</link>
		<comments>http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 23:04:42 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1781</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' addthis:title='WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>We have today released WebRecorder 3.0. This is a major rewrite with a better recording engine capable of recording more tags and producing leaner, cleaner, code and a faster and more reliable runtime. It also introduces a download manager so that file downloads can be recorded and scripted more easily without recourse to sending keystrokes [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' addthis:title='WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/06/07/special-offer-get-webrecorder-free/' rel='bookmark' title='Permanent Link: Special Offer &#8211; Get WebRecorder Free'>Special Offer &#8211; Get WebRecorder Free</a></li><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' addthis:title='WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>We have today released <a href="http://www.mjtnet.com/webrecorder.htm">WebRecorder</a> 3.0.</p>
<p><img title="webrecorder3_400w" src="http://www.mjtnet.com/blog/wp-content/uploads/2012/01/webrecorder3_400w.jpg" alt="WebRecorder 3.0 - Faster more reliable internet macros" width="400" height="244" /></p>
<p>This is a major rewrite with a better recording engine capable of recording more tags and producing leaner, cleaner, code and a faster and more reliable runtime.</p>
<p>It also introduces a download manager so that file downloads can be recorded and scripted more easily without recourse to sending keystrokes to IE&#8217;s standard file download box.</p>
<p>We&#8217;ve improved the existing commands so that you can script more tags and use more attributes and added new functions for retrieving data, retrieving the screen position of elements and interfacing with the new native IE functions in Macro Scheduler 13.1.</p>
<p>Oh, and you no longer need to use the mouse to record clicks and form fills!</p>
<ul>
<li>Cleaner, leaner, faster code.</li>
<li>More reliable method for waiting for documents to complete loading</li>
<li>Download manager for scripting file downloads</li>
<li>Better error trapping</li>
<li>Ability to set timeout for Clicks and Form Fills etc</li>
<li>Click and Form fill functions will wait until target tags exist (within timeout)</li>
<li>New functions for extracting data</li>
<li>New function to get X,Y screen position of elements</li>
<li>No need to use the mouse to identify recorded elements</li>
<li>New, improved UI look and feel</li>
<li>Runtime component integrates better with Macro Scheduler&#8217;s script controller (faster termination, less liable to hang ups when aborting scripts etc)</li>
<li>Interface easily with Macro Scheduler&#8217;s IEGetTags and IETagEvent function</li>
<li>New script function for waiting for text in the page before continuing</li>
<li>Functions to automatically set extracted tag buffer size and avoid buffer overruns</li>
</ul>
<p><a href="http://www.mjtnet.com/webrecorder.htm">More information on WebRecorder here</a>.  WebRecorder 3.0 scripts require Macro Scheduler 13.1 to run.</p>
<p>Enterprise customers with in-date maintenance can already download WebRecorder 3.0 from the <a href="http://www.mjtnet.com/dldregd.htm">registered download area</a>.</p>
<p>Other customers can view upgrade options in their <a href="http://www.mjtnet.com/dldregd.htm">registered download account</a>, or download a <a href="http://www.mjtnet.com/downloads.htm">trial version here</a>.</p>
<p><a href="http://www.mjtnet.com/downloads.htm">Trial Downloads</a> | <a href="http://www.mjtnet.com/dldregd.htm">Registered Downloads</a> | <a href="http://www.mjtnet.com/upgrade.htm">Upgrades</a></p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' addthis:title='WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/06/07/special-offer-get-webrecorder-free/' rel='bookmark' title='Permanent Link: Special Offer &#8211; Get WebRecorder Free'>Special Offer &#8211; Get WebRecorder Free</a></li><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scraping Data From Web Pages</title>
		<link>http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/</link>
		<comments>http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/#comments</comments>
		<pubDate>Fri, 20 May 2011 13:02:58 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1547</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' addthis:title='Scraping Data From Web Pages'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>I&#8217;ve seen quite a lot of requests lately from people wanting to know how to extract text from web pages. Macro Scheduler&#8217;s optional WebRecorder add-on simplifies the automation of web pages and includes functions for extracting tables, text or HTML from web page elements. WebRecorder&#8217;s Tag Extraction wizard makes it easy to create the code. [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' addthis:title='Scraping Data From Web Pages' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' rel='bookmark' title='Permanent Link: WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions'>WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' addthis:title='Scraping Data From Web Pages'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>I&#8217;ve seen quite a lot of requests lately from people wanting to know how to extract text from web pages.</p>
<p>Macro Scheduler&#8217;s optional <a href="http://www.mjtnet.com/webrecorder.htm">WebRecorder</a> add-on simplifies the automation of web pages and includes functions for extracting tables, text or HTML from web page elements.  WebRecorder&#8217;s Tag Extraction wizard makes it easy to create the code.</p>
<p>Sometimes you can choose a specific HTML element and identify it uniquely via it&#8217;s ID or NAME attribute.  But other times you might want all the text from the whole page, or you may need to extract the entire page and then parse out the bits you&#8217;re interested in using RegEx or some other string manipulation functions.  </p>
<p>To extract an entire page I specify the BODY element.  If you want to extract data from web pages it does help if you know a little about HTML.  And if you do you&#8217;ll know that each page has just one BODY element which contains the code making up the visible portion of the page. </p>
<p>Here&#8217;s code produced using WebRecorder when navigating to mjtnet.com and using the Tag Extraction wizard to extract the BODY text:</p>
<pre name="code" class="macroscript">IE_Create>0,IE[0]

IE_Navigate>%IE[0]%,http://www.mjtnet.com/,r
IE_Wait>%IE[0]%,r
Wait>delay

//Modify buffer size if required (you may get a crash if buffer size too small for data) ...
Let>BODY0_SIZE=9999
IE_ExtractTag>%IE[0]%,,BODY,0,0,BODY0,r
MidStr>r_6,1,r,BODY0

MessageModal>BODY0</pre>
<p>The macro simply displays just the text in a message box but could be set to pull out the full HTML.  You could then parse it with RegEx to get the information you are interested in.  </p>
<p>You will need WebRecorder installed for the above to work.</p>
<p>If you don&#8217;t have WebRecorder you can do the same with a bit more work using VBScript.  Some library functions for doing this can be found <a href="http://www.mjtnet.com/usergroup/viewtopic.php?t=1461">here</a> and <a href="http://www.mjtnet.com/usergroup/viewtopic.php?t=4660">here</a>.</p>
<p>So here&#8217;s the equivalent in VBScript:</p>
<pre name="code" class="macroscript">VBSTART
Dim IE

'Creates IE instance
Sub CreateIE
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible=1
End Sub

'Navigate to an IE instance
Sub Navigate(URL)
  IE.Navigate URL
  do while IE.Busy
  loop
End Sub

'This function extracts text from a specific tag by name and index
'e.g. TABLE,0 (1st Table element) or P,1 (2nd Paragraph element)
'set all to 1 to extract all HTML, 0 for only inside text without HTML
Function ExtractTag(TagName,Num,all)
  dim t
  set t = IE.document.getElementsbyTagname(Tagname)
  if all=1 then
    ExtractTag = t.Item(Num).outerHTML
  else
    ExtractTag = t.Item(Num).innerText
  end if
End Function
VBEND

VBRun>CreateIE
VBRun>Navigate,www.mjtnet.com

VBEval>ExtractTag("BODY",0,0),BodyText
MessageModal>BodyText</pre>
<p>But what if you already have a macro which already opens IE, or works against an already open instance of IE?  The above macros need to create the IE instance before they can access them and extract data from them.  You may have a macro that already starts IE some other way &#8211; maybe just by using a RunProgram or ExecuteFile call, or indirectly via some other application.   Many times people tackle the extraction of data from such an IE window by sending keystrokes to do a Select-All, Edit/Copy and then use GetClipboard; or even File/Save As to save the HTML to a file.  This of course adds time and can be unreliable.   So how else can we do it?</p>
<p>Well, <a href="http://www.mjtnet.com/usergroup/viewtopic.php?t=4660">this tip</a> shows us a function we can use to attach to an existing IE instance.  So let&#8217;s use that and then use our ExtractTag function to pull out the BODY HTML:</p>
<pre name="code" class="macroscript">VBSTART
Dim IE

' Attaches to an already running IE instance with given URL
Sub GetIE(URL)
  Dim objInstances, objIE
  Set objInstances = CreateObject("Shell.Application").windows
  If objInstances.Count > 0 Then '/// make sure we have instances open.
    For Each objIE In objInstances
      If InStr(objIE.LocationURL,URL) > 0 then
        Set IE = objIE
      End if
    Next
  End if
End Sub

'This function extracts text from a specific tag by name and index
'e.g. TABLE,0 (1st Table element) or P,1 (2nd Paragraph element)
'set all to 1 to extract all HTML, 0 for only inside text without HTML
Function ExtractTag(TagName,Num,all)
  dim t
  set t = IE.document.getElementsbyTagname(Tagname)
  if all=1 then
    ExtractTag = t.Item(Num).outerHTML
  else
    ExtractTag = t.Item(Num).innerText
  end if
End Function
VBEND

VBRun>GetIE,www.mjtnet.com

VBEval>ExtractTag("BODY",0,1),BodyHTML
MessageModal>BodyHTML</pre>
<p>This snippet assumes a copy of IE is already open and pointing to www.mjtnet.com.  The GetIE call creates a link to that IE window and then we use the ExtractTag function to pull out the HTML of the BODY element.</p>
<p>These examples use the BODY element, which will contain everything displayed on the page.  As I mentioned before you can be more specific and specify some other element, and with WebRecorder, or a modified version of the ExtractTag VBScript function use other attributes to identify the element (the existing VBScript ExtractTag function shown above just uses the numeric index).  WebRecorder tries to make it simple by giving you a point and click wizard, making some assumptions for you, so that you need not fully understand the HTML of the page.  But it still helps you understand HTML.  Looking at the source of the page you should be able to identify the element you need to extract from.  And whether you extract directly from that or extract the BODY and then use RegEx being prepared to delve into the HTML source is going to get you further.</p>
<p><strong>UPDATE: 19th January 2012</strong></p>
<p>As of version 13.0.06 Macro Scheduler now includes a function called IEGetTags.  For a given tag type and IE tab this will retrieve an array of tag contents.  It can extract just the text, or html of the tags.  This example extracts the inner HTML of all DIV elements in the open IE document currently at www.mjtnet.com:</p>
<pre name="code" class="macroscript">IEGetTags>mjtnet.com,DIV,H,divArr</pre>
<p>You can then cycle through each one with a Repeat Until</p>
<pre name="code" class="macroscript">If>divArr_count>0
  Let>k=0
  Repeat>k
    Let>k=k+1
    Let>this_div_html=divArr_%k%
    ..
    .. do something with it
    .. e.g. use RegEx or substring searching to determine
    .. if this is the DIV you want and extract from it
    ..
  Until>k=divArr_count
Endif</pre>
<p>To further identify the tag you are interested in, or find the data you want, you can use RegEx, <a href="http://www.mjtnet.com/blog/2009/02/26/sneak-peak-simplified-regular-expression-support/">EasyPatterns</a>, or string functions.</p>
<p>Macro Scheduler 13.0.06 and above also has a function called IETagEvent which will let you simulate a Click on a given tag, focus it, or modify its value.  So once you have identified a tag using IEGetTags and your Repeat/Until loop you can click on it, focus it or modify its value (e.g. for form fields).</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' addthis:title='Scraping Data From Web Pages' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2012/01/24/webrecorder-3-0-faster-more-reliable-more-functions/' rel='bookmark' title='Permanent Link: WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions'>WebRecorder 3.0 &#8211; Faster, More Reliable, More Functions</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth</title>
		<link>http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/</link>
		<comments>http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/#comments</comments>
		<pubDate>Tue, 25 May 2010 16:23:44 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1221</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/' addthis:title='Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>As noted yesterday I have been waiting on Twitter to provide xAuth access. They declined, saying it was not appropriate. I&#8217;m not really sure why. No matter, I decided to make a small DLL to simplify Tweeting from Macro Scheduler. It uses the full oAuth interface. Implementing oAuth in Macro Scheduler code would require lots [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/' addthis:title='Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' rel='bookmark' title='Permanent Link: Scraping Data From Web Pages'>Scraping Data From Web Pages</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/' addthis:title='Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>As noted yesterday I have been waiting on <a href="http://www.twitter.com/">Twitter</a> to provide xAuth access.  They declined, saying it was not appropriate.  I&#8217;m not really sure why.  </p>
<p>No matter, I decided to make a small DLL to simplify Tweeting from <a href="http://www.mjtnet.com/macro_scheduler.htm">Macro Scheduler</a>.  It uses the full oAuth interface.</p>
<p>Implementing oAuth in Macro Scheduler code would require lots of VBScript code and would be very complicated (although doable in theory).  So instead I decided to create a DLL which you can use in Macro Scheduler to tweet in one line of code.</p>
<p>You can <a href="http://www.mjtnet.com/software/tweetlib.zip">download it here</a>.</p>
<p>And then to post a status update all you need to do is something like this:</p>
<pre name="code" class="macroscript">Let>message=Hello from Macro Scheduler
LibFunc>%SCRIPT_DIR%\tweetlib.dll,UpdateStatus,r,message,buff,1024</pre>
<p>Note that the first time you call UpdateStatus you will be asked to log into Twitter and click &#8220;Allow&#8221; to authorise Macro Scheduler to access your account.  You will then be given a PIN to enter.  You only need to do this once.  If you ever need to revoke access and start over call the RemoveCredentials function.  Your Twitter username and password are NOT stored anywhere.  This uses the oAuth authorisation scheme which provides an access token.  It is the access token which is stored and this only allows Macro Scheduler to access the API for your account.</p>
<p>The return buffer will contain the XML of the status update operation if successful or an error message if not.  </p>
<p>See readme.txt and sample .scp in the zip file.  Enjoy.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/' addthis:title='Tweetlib: A DLL Plugin for Tweeting Status Updates via oAuth' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/05/20/scraping-data-from-web-pages/' rel='bookmark' title='Permanent Link: Scraping Data From Web Pages'>Scraping Data From Web Pages</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2010/05/25/tweetlib-a-dll-plugin-for-tweeting-status-updates-via-oauth/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Tweeting from Macro Scheduler Without the API</title>
		<link>http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/</link>
		<comments>http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/#comments</comments>
		<pubDate>Mon, 24 May 2010 13:51:02 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1213</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/' addthis:title='Tweeting from Macro Scheduler Without the API'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>A while back I posted an article showing how to Tweet via Twitter&#8216;s API. It uses basic authentication which Twitter plan to turn off in the near future. The alternative, oAuth is awkward for desktop based apps, but xAuth is now available and should be doable in Macro Scheduler. I have requested xAuth access from [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/' addthis:title='Tweeting from Macro Scheduler Without the API' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2011/11/29/macro-scheduler-13-0-03-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.0.03 Update'>Macro Scheduler 13.0.03 Update</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/' addthis:title='Tweeting from Macro Scheduler Without the API'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>A while back <a href="http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/">I posted an article showing how to Tweet</a> via <a href="http://www.twitter.com">Twitter</a>&#8216;s API.  It uses basic authentication which Twitter plan to turn off in the near future. The alternative, oAuth is awkward for desktop based apps, but xAuth is now available and should be doable in Macro Scheduler.  I have requested xAuth access from Twitter and, assuming it&#8217;s doable, will try and provide an example once I&#8217;ve received it and tried it out.</p>
<p>In the mean time it occurred to me that we don&#8217;t really need an API if all we want to do is send a status update.  We can do that easily using Macro Scheduler and WebRecorder functions by controlling an instance of Internet Explorer, which can be done in the background. </p>
<p>Below is a script which demonstrates this.  It offers a function called LoginToTwitter which need only be called once per session, and an UpdateStatus function to update your status.  Just set your Twitter username and password in the first two lines and you should be all set.</p>
<pre name="code" class="macroscript">Let>TW_USERNAME=XXXXX
Let>TW_PASSWORD=XXXXX

//only need do this once per session
GoSub>LoginToTwitter

GoSub>UpdateStatus,This is a test

GoSub>UpdateStatus,This is a test 2

GoSub>LogOut

// END

//*** SUBROUTINES ***//
SRT>LoadWR
  //load the WebRecorder runtime
  LibLoad>IEAuto.dll,hIE
  If>hIE=0
    MessageModal>Could not load IEAuto.dll, make sure it is in the path or edit the LibLoad line.
    Exit>0
  EndIf
END>LoadWR

SRT>LoginToTwitter
  GoSub>LoadWR
  //open IE
  LibFunc>hIE,CreateIE,ieTwitter,0
  LibFunc>hIE,ShowIE,res,ieTwitter,1

  //log in to Twitter
  LibFunc>hIE,Navigate,r,ieTwitter,http://twitter.com/login
  LibFunc>hIE,WaitIE,r,ieTwitter
  LibFunc>hIE,FormFill,r,ieTwitter,,,session[username_or_email],TW_USERNAME,0
  LibFunc>hIE,FormFill,r,ieTwitter,,,session[password],TW_PASSWORD,submit

  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
END>LoginToTwitter

SRT>UpdateStatus
  LibFunc>hIE,FormFill,r,ieTwitter,,,status,UpdateStatus_VAR_1,submit
  LibFunc>hIE,WaitIE,r,ieTwitter
  Wait>1
END>UpdateStatus

SRT>LogOut
  LibFunc>hIE,KillIE,r,ieTwitter
END>LogOut</pre>
<p>You need the IEAuto.DLL library which is installed with <a href="http://www.mjtnet.com/webrecorder.htm">WebRecorder</a>.  </p>
<p>For a bit of fun the following code copies the currently highlighted text to the clipboard and tweets it.  So assigned to a hot key it can be used to tweet any text from any application.   </p>
<pre name="code" class="macroscript">Press CTRL
Send>c
Release CTRL
WaitClipBoard
GetClipBoard>theText
GoSub>UpdateStatus,theText</pre>
<p>The real challenge is finding something useful to do with it! <img src='http://www.mjtnet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/' addthis:title='Tweeting from Macro Scheduler Without the API' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2011/11/29/macro-scheduler-13-0-03-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.0.03 Update'>Macro Scheduler 13.0.03 Update</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2010/05/24/tweeting-from-macro-scheduler-without-the-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choose Your Web Browser</title>
		<link>http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/</link>
		<comments>http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:39:18 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1112</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/' addthis:title='Choose Your Web Browser'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>One of my Windows XP systems installed an automatic update last night when I shut it down.  This morning I was presented with this: As I understand it this is as a result of an EU competition law decision.   Is this a good thing or a bad thing? On the one hand it seems [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/' addthis:title='Choose Your Web Browser' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/04/26/authenticate-your-exes-discounted-code-signing/' rel='bookmark' title='Permanent Link: Authenticate Your EXEs &#8211; Discounted Code Signing'>Authenticate Your EXEs &#8211; Discounted Code Signing</a></li><li><a href='http://www.mjtnet.com/blog/2011/05/23/why-cant-i-colour-my-dialog-buttons/' rel='bookmark' title='Permanent Link: Why Can&#8217;t I Colour My Dialog Buttons?'>Why Can&#8217;t I Colour My Dialog Buttons?</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/' addthis:title='Choose Your Web Browser'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>One of my Windows XP systems installed an automatic update last night when I shut it down.  This morning I was presented with this:</p>
<p><img class="alignleft size-medium wp-image-1111" style="margin-left: 10px; margin-right: 10px;" title="Windows EU WebBrowser Choice" src="http://www.mjtnet.com/blog/wp-content/uploads/2010/03/eu_webbrowser_choice-300x164.jpg" alt="Windows EU WebBrowser Choice" width="300" height="164" /></p>
<p>As I understand it this is as a result of an EU competition law decision.   Is this a good thing or a bad thing?</p>
<p>On the one hand it seems a waste of money and illogical.</p>
<p>I&#8217;m no fan of IE, but why shouldn&#8217;t Microsoft build a web browser and make it part of their operating system?  Should the EU force them to offer a choice of text editors, calculators, paint programs and calendar applications too? Where should it end?</p>
<p>Plus, yet another dialog like this is surely going to confuse the ordinary user.  Many have no idea what a &#8220;web browser&#8221; is and just call it &#8220;My Internet&#8221; or &#8220;Google&#8221;.  The dialog preceding the one above has to go to the trouble of explaining what a web browser is.  And isn&#8217;t the user just going to take the first option anyway?  In which case should the EU force Microsoft to make IE8 something other than the default option?</p>
<p>But then if I were trying to sell a web browser I guess I would welcome this decision. It might give me a little extra exposure.</p>
<p>What do you think?</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/' addthis:title='Choose Your Web Browser' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/04/26/authenticate-your-exes-discounted-code-signing/' rel='bookmark' title='Permanent Link: Authenticate Your EXEs &#8211; Discounted Code Signing'>Authenticate Your EXEs &#8211; Discounted Code Signing</a></li><li><a href='http://www.mjtnet.com/blog/2011/05/23/why-cant-i-colour-my-dialog-buttons/' rel='bookmark' title='Permanent Link: Why Can&#8217;t I Colour My Dialog Buttons?'>Why Can&#8217;t I Colour My Dialog Buttons?</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2010/03/04/choose-your-web-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running Macro Scheduler Macros over the Web Via PHP</title>
		<link>http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/</link>
		<comments>http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 09:31:39 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=1057</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/' addthis:title='Running Macro Scheduler Macros over the Web Via PHP'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Here&#8217;s a quick and simple proof of concept for running Macro Scheduler macros via the web and having their output displayed in the user&#8217;s browser: 1) If you don&#8217;t already have a Windows based web server with PHP running, download and install WAMPServer. It&#8217;s easy. 2) Create a simple PHP script which takes an EXE [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/' addthis:title='Running Macro Scheduler Macros over the Web Via PHP' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/06/09/about-the-macroscript-sdk/' rel='bookmark' title='Permanent Link: About the MacroScript SDK &#8211; How to Run Macro Scheduler Code Within Your Own Applications'>About the MacroScript SDK &#8211; How to Run Macro Scheduler Code Within Your Own Applications</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/' addthis:title='Running Macro Scheduler Macros over the Web Via PHP'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Here&#8217;s a quick and simple proof of concept for running Macro Scheduler macros via the web and having their output displayed in the user&#8217;s browser:</p>
<div id="attachment_1058" class="wp-caption alignnone" style="width: 470px"><a href="http://www.mjtnet.com/images/wamp_msched.jpg"><img class="size-full wp-image-1058 " title="Running Macro Scheduler Macros Over the Web Via PHP" src="http://www.mjtnet.com/blog/wp-content/uploads/2010/01/wamp_msched_small.jpg" alt="Running Macro Scheduler Macros Over the Web Via PHP" width="460" height="327" border="0"/></a><p class="wp-caption-text">The screenshot shows the PHP script, Macro Scheduler script and Internet Explorer being used to run the macro.</p></div>
<p>1) If you don&#8217;t already have a Windows based web server with PHP running, download and install <a href="http://www.wampserver.com/">WAMPServer</a>. It&#8217;s easy.</p>
<p>2) Create a simple PHP script which takes an EXE name as a parameter and any parameters you want to pass to it.  The following script will run EXEs that are in the c:\wamp\ folder, passing in any parameters provided and will dispay the EXEs output.</p>
<pre name="code" class="php">
&lt;?php
$exe = $_GET['exe'];

$dir = "c:\\wamp\\";

$parms = "";
foreach($_GET as $key=&gt;$val) {
  $parms .= "/$key=$val ";
}

echo shell_exec("\"$dir$exe\" $parms");
?&gt;
</pre>
<p>3) PHP&#8217;s safemode must be disabled for this script to work.</p>
<p>4) Create a Macro Scheduler macro and use SOWrite or SOWriteLn to output information.  Compile it with the &#8220;Create Console App&#8221; option checked.  Compile the EXE (or copy it) to the c:\wamp\ folder.</p>
<p>5) Now the macro can be executed via the web using http://servername/runmacro.php?exe=my.exe&amp;parm1=value&amp;etc=&#8230; which could be a link or entered into the browser directly.</p>
<p>6) Consider adding further security to the script to prevent anyone running any EXE on your server, or putting it in a password protected folder.  I&#8217;ll leave that to you.</p>
<p><a href="http://www.mjtnet.com/macro_scheduler_enterprise.htm">Macro Scheduler Enterprise</a> comes with the msNet Remote Controller which includes a CGI module for running Macro Scheduler macros via web servers.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/' addthis:title='Running Macro Scheduler Macros over the Web Via PHP' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/06/09/about-the-macroscript-sdk/' rel='bookmark' title='Permanent Link: About the MacroScript SDK &#8211; How to Run Macro Scheduler Code Within Your Own Applications'>About the MacroScript SDK &#8211; How to Run Macro Scheduler Code Within Your Own Applications</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2012/01/24/macro-scheduler-13-1-update/' rel='bookmark' title='Permanent Link: Macro Scheduler 13.1 Update'>Macro Scheduler 13.1 Update</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2010/01/29/running-macro-scheduler-macros-over-the-web-via-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twittering from Macro Scheduler with the Twitter API</title>
		<link>http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/</link>
		<comments>http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 07:42:13 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=593</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/' addthis:title='Twittering from Macro Scheduler with the Twitter API'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Way back in the deep and distant past when the Internet was new and Bill Gates thought it was just a passing fad, I remember reading about a Cola vending machine on a University campus that some frivolous young boffins hooked up to the &#8216;net so that you could check its inventory from anywhere in [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/' addthis:title='Twittering from Macro Scheduler with the Twitter API' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/05/20/macro-scheduler-12-1-6-now-with-macro-recording-in-script-editor/' rel='bookmark' title='Permanent Link: Macro Scheduler 12.1.6 &#8211; Now With Macro Recording in Script Editor'>Macro Scheduler 12.1.6 &#8211; Now With Macro Recording in Script Editor</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/10/macro-scheduler-12-1-7-available/' rel='bookmark' title='Permanent Link: Macro Scheduler 12.1.7 Available'>Macro Scheduler 12.1.7 Available</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/' addthis:title='Twittering from Macro Scheduler with the Twitter API'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Way back in the deep and distant past when the Internet was new and Bill Gates thought it was just a passing fad, I remember reading about a Cola vending machine on a University campus that some frivolous young boffins hooked up to the &#8216;net so that you could check its inventory from anywhere in the world using an old fashioned network command called &#8220;finger&#8221;.  Why? Because they could.</p>
<p>Fast forward to the technologies of the current day and the latest trend of Twitter, and history is repeating itself.  In the last week I&#8217;ve read about a restaurant that can take orders via Twitter, a bakery tweeting the emergence of fresh loaves from the oven; and, utterly pointless, some guys who created a system which sends a tweet every time their cat enters or exits its cat flap.  Why?  Well, because they can I guess.</p>
<p>Not wanting to be left out I decided to write some <a href="http://www.mjtnet.com/macro_scheduler.htm">Macro Scheduler</a> code to tweet status updates and monitor replies. Why? Well there might be a good reason for being able to do this &#8211; I&#8217;m sure someone will have one.  Perhaps you have a client who wants you to set up a system to monitor the movement of his cat, process restaurant orders, or your local baker wants an automated fresh-loaf tweeter!  But mostly, it&#8217;s because we can.</p>
<p>You&#8217;ll find the Twitter API documentation <a href="http://apiwiki.twitter.com/">here</a>.  Here&#8217;s the code to Tweet a status update:</p>
<pre name="code" class="macroscript">Let>username=YOURTWITTERNAME
Let>password=YOURPASSWORD

//Tweet from Macro Scheduler
Let>url=http://%username%:%password%@twitter.com/statuses/update.xml
Let>message=Kitty just left the buildng
HTTPRequest>url,,POST,status=%message%,result</pre>
<p>Being serious for a moment I can see how a macro that monitors an application might want to post status updates to Twitter, or a backup script could alert you by Twitter when there&#8217;s a problem.  It might be a public system, but don&#8217;t forget that Twitter profiles can be made private too, and Tweets can be viewed on and sent from your BlackBerry, iPhone, or even by SMS.</p>
<p>The following script sets up a loop which monitors your Twitter stream for &#8220;mentions&#8221; of your username.  This might form the basis of a script which retrieves orders.  Perhaps it could listen to Twitter for commands and carry out actions based on what message was sent.  Or perhaps you just want a macro which does something when a cat decides to head out for the night.  Use your imagination.</p>
<pre name="code" class="macroscript">Let>username=YOURTWITTERNAME
Let>password=YOURPASSWORD
Let>ini_file=%SCRIPT_DIR%\twit.ini
Let>_delay=30

VBSTART
VBEND

//monitor twitter username "mentions" loop
Label>monitor_loop

Let>url=http://%username%:%password%@twitter.com/statuses/mentions.xml
HTTPRequest>url,,GET,,result

//remove the <user> portion (I don't need it and it avoids distinguishing the text IDs from the user IDs.
RegEx><user>[^>](.*?)</user>,result,0,user_matches,nf,1,,result

//extract all texts
RegEx>(?<=<text>)[^>]*?(?=</text>),result,0,text_matches,num_texts,0
If>num_texts>0
  //extract all ids
  RegEx>(?<=<id>)[^>]*?(?=</id>),result,0,id_matches,num_ids,0

  //get last known
  Let>last_known_id=0
  IfFileExists>ini_file
    ReadIniFile>ini_file,SETTINGS,LAST_ID,last_known_id
  Else
    WriteLn>ini_file,wlnr,
  Endif

  //iterate through texts
  Let>k=0
  Repeat>k
    Let>k=k+1
    Let>this_id=id_matches_%k%
    If>this_id>last_known_id
      Let>msg_text=text_matches_%k%
      /*
      msg_text contains the message
      Use your imagination here!
      For now we'll show it in a message
      */
      MessageModal>msg_text
    Endif
  Until>k=num_texts

  //store last ID
  EditIniFile>ini_file,SETTINGS,LAST_ID,id_matches_1
Endif

Wait>_delay
Goto>monitor_loop</pre>
<p>The script retrieves the 20 most recent &#8220;mentions&#8221;.  It stores the last seen ID in an INI file so that on the next check it ignores those it has seen before, only retrieving messages with a larger ID number.  </p>
<p>This is a quick and dirty solution with no error checking, using RegEx to parse the XML that is returned by the call to Twitter.  You may prefer to use the MS XML object as <a href="http://www.mjtnet.com/usergroup/viewtopic.php?t=5029">shown here</a>.</p>
<p>Whether this proves useful or completely pointless, I hope you have fun. If you&#8217;re using Macro Scheduler with Twitter, please add a comment below to let us know how &#8230; and why!</p>
<p>Don&#8217;t forget you can <a href="http://twitter.com/marcustettmar">follow me on Twitter</a> where I may occassionally say something useful.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/' addthis:title='Twittering from Macro Scheduler with the Twitter API' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/05/20/macro-scheduler-12-1-6-now-with-macro-recording-in-script-editor/' rel='bookmark' title='Permanent Link: Macro Scheduler 12.1.6 &#8211; Now With Macro Recording in Script Editor'>Macro Scheduler 12.1.6 &#8211; Now With Macro Recording in Script Editor</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/13/calling-macro-scheduler-functions-from-powershell/' rel='bookmark' title='Permanent Link: Calling Macro Scheduler Functions from PowerShell'>Calling Macro Scheduler Functions from PowerShell</a></li><li><a href='http://www.mjtnet.com/blog/2011/06/10/macro-scheduler-12-1-7-available/' rel='bookmark' title='Permanent Link: Macro Scheduler 12.1.7 Available'>Macro Scheduler 12.1.7 Available</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2009/04/20/twittering-from-macro-scheduler-with-the-twitter-api/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>It&#8217;s time to bring down IE6!</title>
		<link>http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/</link>
		<comments>http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 12:12:54 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=531</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/' addthis:title='It&#8217;s time to bring down IE6!'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Some of you may remember that we had some issues with Internet Explorer 6 support when we released our new web site. I made some negative comments about IE6. And I was being polite. Unfortunately IE6 is still in use in millions of companies and, as I mentioned in that last post, some 35% of [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/' addthis:title='It&#8217;s time to bring down IE6!' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


No related posts.]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/' addthis:title='It&#8217;s time to bring down IE6!'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p><a href="http://www.mjtnet.com/blog/2009/01/06/new-year-new-site-new-look-new-logo-new-podcasts/"><img src="http://www.netmag.co.uk/files/bd.png" alt="Bring Down IE6" align="left" hspace="5"/></a></p>
<p>Some of you may remember that we had some issues with Internet Explorer 6 support when we released our new web site.  I <a href="http://www.mjtnet.com/blog/2009/01/06/new-year-new-site-new-look-new-logo-new-podcasts/">made some negative comments</a> about IE6.  And I was being polite.  Unfortunately IE6 is still in use in millions of companies and, as I mentioned in that last post, some 35% of our web traffic is delivered by people using IE6.  If it were up to me I&#8217;d banish it to web browser hell.</p>
<p>So I&#8217;m all for a new campaign from .Net magazine: <a href="http://www.bringdownie6.com/">Bring Down IE6</a>.   </p>
<p>If you have the power to do so, upgrade now, or try out <a href="http://www.getfirefox.com/">Firefox</a> or <a href="http://www.google.com/chrome">Google Chrome</a> .  If you&#8217;re working for a company that locks down their PCs and forces you to use IE6, get vocal &#8211; educate your colleagues and IT department.  Petition them to lift you out of the dark ages! <img src='http://www.mjtnet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.bringdownie6.com/">Check out the site</a> to see how you can get involved.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/' addthis:title='It&#8217;s time to bring down IE6!' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2009/03/23/its-time-to-bring-down-ie6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter &#8211; What, Why, How?</title>
		<link>http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/</link>
		<comments>http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 14:20:58 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/?p=429</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/' addthis:title='Twitter &#8211; What, Why, How?'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;re one of those who has heard of Twitter but just doesn&#8217;t quite &#8220;get it&#8221; yet you should find Scott Hanselman&#8217;s How To Twitter &#8211; First Steps and a Twitter Glossary useful. It explains what Twitter is, why it&#8217;s useful and how to tweet. I didn&#8217;t get it at first. I wasn&#8217;t quite sure [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/' addthis:title='Twitter &#8211; What, Why, How?' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/11/09/what-happened-to-good-manners/' rel='bookmark' title='Permanent Link: What happened to good manners?'>What happened to good manners?</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/' addthis:title='Twitter &#8211; What, Why, How?'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you&#8217;re one of those who has heard of <a href="http://www.twitter.com/">Twitter</a> but just doesn&#8217;t quite &#8220;get it&#8221; yet you should find Scott Hanselman&#8217;s <a href="http://www.hanselman.com/blog/HowToTwitterFirstStepsAndATwitterGlossary.aspx">How To Twitter &#8211; First Steps and a Twitter Glossary</a> useful.  It explains what Twitter is, why it&#8217;s useful and how to tweet.</p>
<p>I didn&#8217;t get it at first.  I wasn&#8217;t quite sure what I would get out of it.  Most people who now use Twitter regularly were probably the same to begin with.  Now I realise how useful it is.  I follow friends, people and companies that I find interesting and I want to stay up to date with.  I follow news sites like the BBC and CNN.  I probably get most of my news via Twitter now (In our house the TV seems to be permanently tuned to Nick Jr these days!).  Most of the bloggers I read now tweet their blog updates, so I no longer need to monitor their RSS feeds.  </p>
<p>It&#8217;s useful.  It&#8217;s fun too. Even if you don&#8217;t have anything to say, you can get a lot out of following people that interest you.  And, as Scott says, the nice thing is if you want to respond you can just jump in and reply to anyone.  </p>
<p>So if you&#8217;ve been wondering what all the fuss is about, read <a href="http://www.hanselman.com/blog/HowToTwitterFirstStepsAndATwitterGlossary.aspx">Scott&#8217;s blog post</a>, jump in and join the conversation.  You can start by <a href="http://twitter.com/marcustettmar">following me</a>.  My twitter ID is <a href="http://twitter.com/marcustettmar">http://twitter.com/marcustettmar</a> <img src='http://www.mjtnet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/' addthis:title='Twitter &#8211; What, Why, How?' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/11/09/what-happened-to-good-manners/' rel='bookmark' title='Permanent Link: What happened to good manners?'>What happened to good manners?</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2009/02/05/twitter-what-why-how/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox2 or IE7?</title>
		<link>http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/</link>
		<comments>http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/#comments</comments>
		<pubDate>Thu, 19 Oct 2006 17:33:42 +0000</pubDate>
		<dc:creator>Marcus Tettmar</dc:creator>
				<category><![CDATA[Web/Tech]]></category>

		<guid isPermaLink="false">http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/' addthis:title='Firefox2 or IE7?'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>I see IE7 has been released. Haven&#8217;t installed it yet, but I do have an early beta version running on another PC and found that a bit clunky. I&#8217;m a Firefox fan though, so I&#8217;ve just downloaded and installed Firefox 2 RC3. I like it. The interface has been given a subtle update but it [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/' addthis:title='Firefox2 or IE7?' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>


Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/08/25/comparing-old-and-new-why-upgrade/' rel='bookmark' title='Permanent Link: Comparing Old and New &#8211; Why Upgrade?'>Comparing Old and New &#8211; Why Upgrade?</a></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/' addthis:title='Firefox2 or IE7?'  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>I see IE7 has been released.  Haven&#8217;t installed it yet, but I do have an early beta version running on another PC and found that a bit clunky.  I&#8217;m a Firefox fan though, so I&#8217;ve just downloaded and installed Firefox 2 RC3.  I like it.  The interface has been given a subtle update but it is also noticeably faster.  I really like the built in spell check.  I used to use the Google toolbar to spell check my posts, when I remembered &#8211; I invariably forgot!  So having spell check built in is a great improvement.  Now I just need to change the dictionary from US English to British English! <img src='http://www.mjtnet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>You can <a href="http://www.mozilla.com/en-US/firefox/2.0/releasenotes/">download Firefox 2 RC3 here</a>.</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/' addthis:title='Firefox2 or IE7?' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>

<p>Related posts:<ol><li><a href='http://www.mjtnet.com/blog/2011/08/25/comparing-old-and-new-why-upgrade/' rel='bookmark' title='Permanent Link: Comparing Old and New &#8211; Why Upgrade?'>Comparing Old and New &#8211; Why Upgrade?</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mjtnet.com/blog/2006/10/19/firefox2-or-ie7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

