<?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>TechBlog &#187; Sendkeys</title>
	<atom:link href="http://techblog.byllemos.com/tag/sendkeys/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.byllemos.com</link>
	<description>Accelerating into the Future with Wisdom about Technology! Ingrid Byllemos</description>
	<lastBuildDate>Tue, 05 Jan 2010 00:04:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Sendkeys in Visual Basic Scripts</title>
		<link>http://techblog.byllemos.com/2008/02/sendkeys-in-visual-basic-scripts/</link>
		<comments>http://techblog.byllemos.com/2008/02/sendkeys-in-visual-basic-scripts/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 21:56:48 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Basic]]></category>
		<category><![CDATA[Sendkeys]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[WshShell]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=43</guid>
		<description><![CDATA[<p>Sendkeys can also be used from a Visual Basic Scripts, which means you can ex. build a vbs file, that can be used for starting up applications, or executing steps that you often have to do.</p>
<p>This is an example&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Sendkeys can also be used from a Visual Basic Scripts, which means you can ex. build a vbs file, that can be used for starting up applications, or executing steps that you often have to do.</p>
<p>This is an example on starting the Notepad and afterwards, as the first thing to do writing the word Hallo:<span id="more-43"></span></p>
<blockquote><p> set WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br />
WshShell.Run &#8220;notepad&#8221;</p>
<p>WScript.Sleep 100</p>
<p>WshShell.AppActivate &#8220;Notesblok&#8221;<br />
WshShell.SendKeys &#8220;Hallo&#8221;</p>
<p>Set WshShell = nothing</p></blockquote>
<p>Lets take a closer look on what the script actual do. The first step is to initiate the object:</p>
<p>set WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)</p>
<p>when the object is initiate, the Notepad application is being startet:</p>
<blockquote><p>WshShell.Run &#8220;notepad&#8221;</p></blockquote>
<p>To be sure that notepad is up and running, there has to be a kind of wait state before continuing. This is done be telling the script to Sleep x milliseconds:</p>
<blockquote><p>WScript.Sleep 100</p></blockquote>
<p>Now the Notepad application has to be activated:</p>
<blockquote><p>WshShell.AppActivate &#8220;Notesblok&#8221;</p></blockquote>
<p>Once Notepad has been activated, it is ready to receive keys. Which now can be send with the sendkeys command:</p>
<blockquote><p>WshShell.SendKeys &#8220;Hallo&#8221;</p></blockquote>
<p>Finally you have to clean up after you &#8211; which means, to stop / close the WshShell you have to set it to nothing.</p>
<blockquote><p>Set WshShell = nothing</p></blockquote>
<p>Thats it &#8211; now you have written the Visual Basic Script &#8211; and all you have to do is save it as a vbs file, or incorporate it into a web page using th vbscript tags.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2008/02/sendkeys-in-visual-basic-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keys in SendKeys</title>
		<link>http://techblog.byllemos.com/2008/01/keys-in-sendkeys/</link>
		<comments>http://techblog.byllemos.com/2008/01/keys-in-sendkeys/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 23:36:45 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Automations]]></category>
		<category><![CDATA[Sendkeys]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=8</guid>
		<description><![CDATA[<p>Most keys can be represented by the character of the key itself. E.g, the key sequence HALLO can be represented simply by &#8220;HALLO&#8221;.</p>
<p>Some special keys, such as the control keys, function keys etc are encoded in a string enclosed&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Most keys can be represented by the character of the key itself. E.g, the key sequence HALLO can be represented simply by &#8220;HALLO&#8221;.</p>
<p>Some special keys, such as the control keys, function keys etc are encoded in a string enclosed by {braces}<br />
See the table below:<br />
<span id="more-8"></span></p>
<table border="0" width="75%">
<tr>
<td><strong>Key</strong></td>
<td><strong>SendKey Equivalent</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>~</td>
<td>{~}</td>
<td>send a tilde (~)</td>
</tr>
<tr>
<td>!</td>
<td>{!}</td>
<td>send an exclamation point (!)</td>
</tr>
<tr>
<td>^</td>
<td>{^}</td>
<td>send a caret (^)</td>
</tr>
<tr>
<td>+</td>
<td>{+}</td>
<td>send a plus sign (+)</td>
</tr>
<tr>
<td>Alt</td>
<td>{ALT}</td>
<td>send an Alt keystroke</td>
</tr>
<tr>
<td>Backspace</td>
<td>{BACKSPACE}, {BS}, or {BKSP}</td>
<td>send a Backspace keystroke</td>
</tr>
<tr>
<td>Break</td>
<td>{BREAK}</td>
<td>send a Break keystroke</td>
</tr>
<tr>
<td>Caps Lock</td>
<td>{CAPSLOCK}</td>
<td>send a Caps Lock keystroke</td>
</tr>
<tr>
<td>Clear</td>
<td>{CLEAR}</td>
<td>Clear the field</td>
</tr>
<tr>
<td>Delete</td>
<td>{DELETE} or {DEL}</td>
<td>send a Delete keystroke</td>
</tr>
<tr>
<td>Down Arrow</td>
<td>{DOWN}</td>
<td>send a Down Arrow keystroke</td>
</tr>
<tr>
<td>End</td>
<td>{END}</td>
<td>send an End keystroke</td>
</tr>
<tr>
<td>Enter</td>
<td>{ENTER} or ~</td>
<td>send an Enter keystroke</td>
</tr>
<tr>
<td>Escape</td>
<td>{ESCAPE} or {ESC}</td>
<td>send an Esc keystroke</td>
</tr>
<tr>
<td>F1 through F16</td>
<td>{F1} through {F16}</td>
<td>send the appropriate Function key</td>
</tr>
<tr>
<td>HOME</td>
<td>{HOME}</td>
<td>send a Home keystroke</td>
</tr>
<tr>
<td>INSERT</td>
<td>{INSERT} or {INS}</td>
<td>send a Insert keystroke</td>
</tr>
<tr>
<td>LEFT ARROW</td>
<td>{LEFT}</td>
<td>send a Left  Arrow keystroke</td>
</tr>
<tr>
<td>Page Down</td>
<td>{PGDN}</td>
<td>send a Page Down keystroke</td>
</tr>
<tr>
<td>RIGHT ARROW</td>
<td>{RIGHT}</td>
<td>send a Right Arrow keystroke</td>
</tr>
<tr>
<td>Space</td>
<td>{SPACE}</td>
<td>send a Spacebar keystroke</td>
</tr>
<tr>
<td>Tab</td>
<td>{TAB}</td>
<td>send a Tab keystroke</td>
</tr>
<tr>
<td>UP ARROW</td>
<td>{UP}</td>
<td>send a Up Arrow keystroke</td>
</tr>
</table>
<p>To specify keys combined with any combination of SHIFT, CTRL, and ALT keys, precede the key code with<br />
one or more of the following:</p>
<p>For SHIFT prefix with +<br />
For CTRL  prefix with ^<br />
For ALT   prefix with %</p>
<p>E.g, the key sequence SHIFT+F12 can be represented simply by &#8220;+{F12}&#8221;.</p>
<p>If a key has to be repeated several time, it can be done by sending the keystroke as {keystroke number}. E.g., the key sequence aaaaa can be represented simply by &#8220;{a 5}&#8221;. Be sure to include a space between keystroke and number. Also be aware of that this is not possible for combined keys &#8211; it will not be possible for ex. SHIFT+F12.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2008/01/keys-in-sendkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Issues with Sendkeys</title>
		<link>http://techblog.byllemos.com/2008/01/issues-with-sendkeys/</link>
		<comments>http://techblog.byllemos.com/2008/01/issues-with-sendkeys/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 23:16:38 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Automations]]></category>
		<category><![CDATA[Navision]]></category>
		<category><![CDATA[Sendkeys]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=7</guid>
		<description><![CDATA[<p>When using Sendkeys there is one big issue, you can not see when/if the application is in the correct state. This means you have to build in some kind of wait states and then after each wait, you must assume&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>When using Sendkeys there is one big issue, you can not see when/if the application is in the correct state. This means you have to build in some kind of wait states and then after each wait, you must assume that the application is in the correct state.<br />
<span id="more-7"></span><br />
There are 3 different kinds of wait states:</p>
<ol>
<li>Using SLEEP after each keystroke</li>
<li>Using BEEP after each keystroke &#8211; when executing BEEPs the OS waits to complete the strokes and then sends the BEEP. Though my experience says that you have to use a BEEP that is at least 10ms long or else it doesn&#8217;t have any effects.</li>
<li>Using a combination of SLEEP and BEEP</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2008/01/issues-with-sendkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sendkeys in Navision</title>
		<link>http://techblog.byllemos.com/2008/01/sendkeys-in-navision/</link>
		<comments>http://techblog.byllemos.com/2008/01/sendkeys-in-navision/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 22:45:50 +0000</pubDate>
		<dc:creator>iby</dc:creator>
				<category><![CDATA[Automations]]></category>
		<category><![CDATA[Navision]]></category>
		<category><![CDATA[Sendkeys]]></category>
		<category><![CDATA[Windows Script Host Object Model]]></category>
		<category><![CDATA[WshShell]]></category>

		<guid isPermaLink="false">http://techblog.byllemos.com/?p=6</guid>
		<description><![CDATA[<p>With SendKeys you simulate user keystrokes &#8211; which mean it is possible to start applications, enter information, choose menus, buttons etc.</p>
<p>SendKeys is a part of Windows Script Host.</p>
<p>Currently I am using this functionality to take over a second&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>With SendKeys you simulate user keystrokes &#8211; which mean it is possible to start applications, enter information, choose menus, buttons etc.</p>
<p>SendKeys is a part of Windows Script Host.</p>
<p>Currently I am using this functionality to take over a second Navision Client, to start an export of objects without any user interventions.</p>
<p><span id="more-6"></span></p>
<p>In Navision SendKeys are found in the automation <em>Windows Script Host Object Model</em> class <em>WshShell</em>.</p>
<p>The first thing to do is to create the automation:</p>
<blockquote><p>IF ISCLEAR(WshShell) THEN<br />
<blankspace>&#8230;..</blankspace>CREATE(WshShell);</p></blockquote>
<p>Activate the application which has to behandled:</p>
<blockquote><p>WshShell.AppActivate(AppName);</p></blockquote>
<p>And then send the keys:</p>
<blockquote><p>WaitForKeys := TRUE;</p>
<p>WshShell.SendKeys(&#8216;{ESC 2}&#8217;,WaitForKeys);<br />
WshShell.SendKeys(&#8216;{DOWN}&#8217;,WaitForKeys);<br />
WshShell.SendKeys(&#8216;{LEFT}&#8217;,WaitForKeys);<br />
WshShell.SendKeys(&#8216;Ver{ENTER}&#8217;,WaitForKeys);</p></blockquote>
<p>When you are finished sending keys then stop the automation by clearing it:</p>
<blockquote><p>CLEAR(WshShell);</p></blockquote>
<p>Pretty simple – right <img src='http://techblog.byllemos.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.byllemos.com/2008/01/sendkeys-in-navision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

