<?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>bc-programming &#187; mystery</title>
	<atom:link href="http://bc-programming.com/blogs/tag/mystery/feed/" rel="self" type="application/rss+xml" />
	<link>http://bc-programming.com/blogs</link>
	<description>Programming, Possums, Ponies, and why you shouldn&#039;t mix any two.</description>
	<lastBuildDate>Wed, 16 May 2012 23:06:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The Mystery of the broken script</title>
		<link>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/</link>
		<comments>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 01:47:09 +0000</pubDate>
		<dc:creator>BC_Programming</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[broken]]></category>
		<category><![CDATA[dead skin cells]]></category>
		<category><![CDATA[gumbi]]></category>
		<category><![CDATA[inside out socks]]></category>
		<category><![CDATA[mystery]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[the scary door]]></category>

		<guid isPermaLink="false">http://bc-programming.com/blogs/?p=130</guid>
		<description><![CDATA[For quite some time I&#8217;ve been wrestling with a mysterious issue. You see, I have several COM components. COM, is, to be usable from the various Script languages installed with windows. I encountered this some time ago when creating a small demonstration script file, something along the lines of the following, which simply showed a [...]]]></description>
			<content:encoded><![CDATA[<div id="fcbk_share"><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><p>For quite some time I&#8217;ve been wrestling with a mysterious issue.</p>
<p>You see, I have several COM components. COM, is,  to be usable from the various Script languages installed with windows. I encountered this some time ago when creating a small demonstration script file, something along the lines of the following, which simply showed a files size:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">Set</span> BCFS = <span class="kw1">CreateObject</span><span class="br0">&#40;</span><span class="st0">&quot;BCFile.BCFSObject&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">Set</span> ffile = BCFS.<span class="me1">GetFile</span><span class="br0">&#40;</span>WScript.<span class="me1">Arguments</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">WScript.<span class="me1">echo</span> BCFS.<span class="me1">FormatSize</span><span class="br0">&#40;</span>ffile.<span class="me1">Size</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Very basic.</p>
<p>However, upon running it, I was greeted with the helpful dialog shown in figure 22-1.<br />
 <div id="attachment_131" class="wp-caption alignleft" style="width: 500px">  <img src="http://bc-programming.com/blogs/wp-content/uploads/2010/04/helpful.png" alt="VBScript ActiveX Error" title="helpful" width="490" height="227" class="size-full wp-image-131" />  <p class="wp-caption-text">Fig 22-1: VBScript Error</p></div> </p>
<p>For some reason or another, the ActiveX Object simply couldn&#8217;t be created (I gathered this after many long hours of research). My first &#8220;retry&#8221; was simple- I at first simply assumed that I had to run as administrator, so I started a command prompt as administrator, and ran it again.</p>
<p>Same error.</p>
<p>This was getting to be annoying. I tried a equal script in JScript/ECMAScript or whatever the hell it&#8217;s called these days:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">BCFS = <span class="kw1">new</span> ActiveXObject<span class="br0">&#40;</span><span class="st0">&quot;BCFile.BCFSObject&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">ffile = BCFS.<span class="me1">GetFile</span><span class="br0">&#40;</span>WScript.<span class="me1">Arguments</span> <span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">WScript.<span class="me1">echo</span><span class="br0">&#40;</span>BCFS.<span class="me1">FormatSize</span><span class="br0">&#40;</span>ffile.<span class="me1">Size</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>It failed as well. so it wasn&#8217;t because of something I was doing wrong in the script. I then tried an alternative; I created a Visual Basic Project, and ran similar code.</p>
<p>It was able to create and use the object with absolutely no difficulty.</p>
<p>I was beginning to find this whole exercise at least as intriguing as it was frustrating. I decided to explore what happened with other operating Systems with VMWare. The script ran fine in Windows 2000 and Windows XP (assuming of course I had installed BCSearch or otherwise had BCFile.dll properly installed). However, it continued to fail. I went into a test frenzy. It failed on Windows 7 on both my laptop and desktop, worked in all my VMWare installations (including Vista) I was stymied.</p>
<p>Then, I ran it on two copies of Windows XP I had on my laptop. Windows XP Pro worked fine. Windows XP x64 did not.</p>
<p>So it was an architecture issue, I surmised. Going on that, I came to the realization that a 64-bit executable cannot instantiate a 32-bit COM object, at least, not an In-Process (DLL) COM object. This was likely the source of the error. I Ran a simple script with a msgbox() that would keep the Script runner running, and then opened Process Explorer.</p>
<p>Not surprisingly, the WScript.exe Process was 64-bit, this was the cause of my problems. the fix? Run the WScript or CScript in %systemroot%\syswow64\ instead. I did so, and the script ran without incident. </p>
<div id="fcbk_share"><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/&via=BC_Programming&text=The Mystery of the broken script&related=:&lang=en&count=horizontal" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div> <p><a href="http://bc-programming.com/blogs/?flattrss_redirect&amp;id=130&amp;md5=3d3fe9d28f0ff02268b26b78a01ecaa0" title="Flattr" target="_blank"><img src="http://bc-programming.com/blogs/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://bc-programming.com/blogs/2010/04/the-mystery-of-the-broken-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=bc_programming&amp;popout=1&amp;url=http%3A%2F%2Fbc-programming.com%2Fblogs%2F2010%2F04%2Fthe-mystery-of-the-broken-script%2F&amp;language=en_GB&amp;category=software&amp;title=The+Mystery+of+the+broken+script&amp;description=For+quite+some+time+I%26%238217%3Bve+been+wrestling+with+a+mysterious+issue.+You+see%2C+I+have+several+COM+components.+COM%2C+is%2C+to+be+usable+from+the+various+Script+languages+installed+with...&amp;tags=broken%2Cdead+skin+cells%2Cgumbi%2Cinside+out+socks%2Cmystery%2Cscript%2Cthe+scary+door%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>

