-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (145 loc) · 6.44 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<html>
<head>
<title>Windows Scripting for Autohotkey</title>
</head>
<body>
<h1>Embedded Windows Scripting<br>(VBScript & JScript)<br>and COM for Autohotkey</h1>
<p>Embed VBScript or JScript directly in your Autohotkey programs.
No temporary files. Full and easy access to COM.</p>
<p>For questions, or to contact me (erictheturtle),
see the <a href="http://www.autohotkey.com/forum/topic21674.html">official thread</a>
in the Autohotkey forums.</p>
<h3>Latest version: v0.21 (beta)</h3>
<p><a href="ws4ahk.ahk">ws4ahk.ahk</a></p>
<p><a href="ws4ahk_public_api.html">Public API Documentation</a></p>
<p><a href="ws4ahk_internal_api.html">Internal API Documentation</a></p>
<hr>
<p>ws4ahk uses the Microsoft Scripting Control to execute your VBScript or JScript.
Nearly all computers will have it installed. In the rare case a computer does not have it
installed, it can easily be downloaded
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D7E31492-2595-49E6-8C02-1426FEC693AC">
directly from Microsoft
</a> and installed. If you don't want to make your end-user install it, as an alternative,
the core "msscript.ocx" file may be accessed directly when ws4ahk is initialized.
<pre> WS_Initialize(<i>scriping language</i>, <i>path to msscript.ocx</i>)</pre>
<hr>
<h3>Useful links:</h3>
<p><a href="http://support.microsoft.com/kb/186063">List of Automation errors (KB186063)</a></p>
<p><a href="http://msdn2.microsoft.com/en-us/library/d1wf56tt.aspx">VBScript Language Reference</a></p>
<p><a href="http://msdn2.microsoft.com/en-us/library/yek4tbz0.aspx">JScript Language Reference</a></p>
<p><a href="http://www.autohotkey.com/forum/topic21674.html">Official Autohotkey forum thread</a></p>
<p><a href="http://blogs.msdn.com/ericlippert/archive/2004/07/14/183241.aspx">The MSDN guru on WSH</a></p>
<hr>
<h3>FAQ</h3>
How is this different from Sean's scripts?<br>
- Hopefully answered in <a href="http://www.autohotkey.com/forum/viewtopic.php?p=138989#138989">this thread</a>.
<hr>
<h3>Known bugs:</h3>
<h4>Memory leak</h4>
<p>A memory leak is occuring during the initialization of COM, the creation of the MSScriptControl,
the setting of the scripting language, then the deletion of the MSScriptControl and uninitialization of COM.
When this process is done repeatedly over 9000 times, the AutoHotKey process will be left using an extra
megabyte of memory than before. I have put this whole process into a <a href="COMmemLeak.ahk">single script</a>
to test it. I am unable to determine if the problem lies in my script, Autohotkey, or
the MSScriptControl itself.</p>
<p>The workaround is, of course, to minimize the number of times you call WS_Initialize() and WS_Uninitialize()
in your scripts.</p>
<h4>Popup timeout</h4>
<p>[<a href="http://www.autohotkey.com/forum/viewtopic.php?p=141847#141847">Reported by YMP</a>]<br>
The pop-up message in the following code should timeout after 2 seconds, but it does not.</p>
<pre>
Code=
(
sh=new ActiveXObject("WScript.Shell");
sh.Popup('Hello, world!', 2);
)
WS_Initialize("JScript")
WS_Exec(Code)
WS_Uninitialize()
</pre>
<p>Any timeout value >= 1.5 seconds will not timeout.
Running the following code in Microsoft Office VBA will produce the same bug</p>
<pre>
Sub buggy()
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "VBScript"
Code = "set sh=CreateObject(""WScript.Shell"")" & vbCrLf & _
"sh.Popup ""Hello, world!"", 1.5"
sc.ExecuteStatement Code
End Sub
</pre>
<p>
There's no explaination for this problem, and appears to be the fault of the Microsoft Scripting Control,
or the WScript.Shell object, or both.</p>
<p>The best workaround is to use Autohotkey's Msgbox function instead.</p>
<hr>
<h3>Change history:</h3>
<pre>
v0.21 (3 July 2008)
- Numerous documentation improvements.
- Fixed error handling in WS_Initialize().
- WS_ReleaseObject(): added check to catch 0 or "" argument.
- Removed extraneous codef(), WS_ErrMsg(), and ScriptStr() functions.
- Renamed internal global variables to be more unique.
- Added MIT License as a formality.
v0.20 (24 Jan 2008)
- WS_Exec()/WS_Eval(): Better handling of errors.
Removed printf() style functionality, moved to codef() function.
Removed leftover Clipboard debug.
- codef(): New function to handle printf() style formatting of code.
Also fixes the bug if in hex mode.
v0.13 (32 Dec 2007)
- Added missing error handling.
v0.12 (9 Dec 2007)
- Fixed bug in WS_Eval() when using the printf style.
- Added home page to docs and renamed internal functions
per suggestion of Joy2DWorld
- Updated documentation a bit
v0.11 (8 Dec 2007)
- Fixed spelling errors
v0.10 (7 Dec 2007)
- Fully documented
- Combined functions to reduce namespace usage
- Renamed internal functions
- Fixed a number of bugs
- Simplified and improved error handling
(got rid of alternate no error checking flavor)
- (Note, public interface has basically not changed from 0.04)
v0.04 (2 Dec 2007)
- Renamed all public functions to have a WS_ prefix.
- WS_Uninitialize() - fixed releasing all resources
- WS_Eval(), WS_Exec() - Improved exception handling
- Added error checking to COM control functions and __GetIDispatch()
- Fixed __GetActiveObject()
- Fixed memory leak for BSTR in __UnpackVARIANT()
- Began adding more detailed documentation.
v0.03 (3 Aug 2007)
- Added the very important credits to Sean in AHK forums and Elias on CodeProject
for their work (I'm ashamed these weren't in the initial release)
- Fixed silly little bug in _CoInitialize()
- More and more comments
v0.02 (26 Jul 2007)
- Fixed so script errors are actually returned without an error (missing global declaration)
- Fixed ScriptStr() so language detection is not case sensitive
- Added error checking in GetComControlInHWND()
- LOTS of code cleaning
v0.01
- Initial release
</pre>
<hr>
<h3>Older versions:</h3>
<p>
<a href="ws4ahk0-20.ahk">v0.20</a><br>
<a href="ws4ahk0-13.ahk">v0.13</a><br>
<a href="ws4ahk0-12.ahk">v0.12</a><br>
<a href="ws4ahk0-11.ahk">v0.11</a><br>
<a href="WS_RemoveErrChk.ahk">WS_RemoveErrChk.ahk</a><br>
<a href="ws4ahk0-04.ahk">v0.04</a><br>
<a href="ws4ahk0-03.ahk">v0.03</a><br>
<a href="ws4ahk0-02.ahk">v0.02</a><br>
<a href="ws4ahk0-01.ahk">v0.01</a>
</p>
<hr>
<p>This page origionally generated using ABCyourway's DHTML Edit control :)</p>
</body>
</html>