IJawsApi

( JScript, AutoIt, C# C++)
:2010
  Twitter   F******k   VKontakte   Telegram   Mastodon

JfwAPI, MS Windows JAWS , . JAWS OLE-Automation, , IJawsApi , , JfwAPI.

IJawsApi , , JScript, VBScript, AutoIt , , OLE-Automation. IJawsApi , JfwApi. , IJawsApi.

IJawsApi

IJawsApi . StopSpeech, -1 ( ), true; 0, false. :

  • JAWS:
    Object.RunScript(parameter1);
    parameter1- JAWS.
  • :
    Object.SayString(parameter1, parameter2);
    parameter1 -- , parameter2 -- , , JAWS ( -1, .. ).
  • JAWS:
    Object.StopSpeech();
    .
  • :
    Object.Enable(parameter1);
    parameter1 -- true ( -1), false ( 0).
  • :
    Object.Disable();
    , , JAWS "" ( IJawsApi ). JAWS Enable().
  • JAWS:
    Object.RunFunction(parameter1);
    parameter1 -- , .. , .

IJawsApi OLE-Automation. , . , (VersionIndependentProgID), : "FreedomSci.JawsApi".

.

JScript AutoIt. , .

JScript

// : hello.js
//   IJawsApi.

//     
var jawsApi = new ActiveXObject("FreedomSci.JawsApi");

//  
jawsApi.SayString("Hello, world!");

//  ,   
jawsApi.RunScript("SaySystemTime");

//    
jawsApi.RunFunction("TypeKey(\"Ctrl+Esc\")");
jawsApi.RunFunction("Delay(10)");
jawsApi.RunFunction("TypeKey(\"Esc\")");

AutoIt

;  hello.au3
;   IJawsApi.

$oJawsApi= ObjCreate("FreedomSci.JawsApi")
if @error then
	Msgbox(0,"JawsApi Test","Failed to create OLE-Object. Error code: " & hex(@error,8))
	exit
endif

;  
$oJawsApi.SayString("Hello, world!")

;  ,   
$oJawsApi.RunScript("SaySystemTime")

;    
$oJawsApi.RunFunction('TypeKey("Ctrl+Esc")')
$oJawsApi.RunFunction("Delay(10)")
$oJawsApi.RunFunction('TypeKey("Esc")')

exit

C#

C# JfW API, . API

//    .Net 3.5:

 Type jfwApi = Type.GetTypeFromProgID("FreedomSci.JawsApi");
 object o = Activator.CreateInstance( jfwApi);
jfwApi.InvokeMember("SayString",
System.Reflection.BindingFlags.InvokeMethod,
null,
o,
new Object[1] {"Hello"});
...
//  .net 4.0     .Net 3.5,
//       :
Type jfwApi = Type.GetTypeFromProgID("FreedomSci.JawsApi");
dynamic o= Activator.CreateInstance( jfwApi);
o.SayString("hello");
...

IJawsApi C++

IJawsApi C++ GUID IID .

#import, , Fsapi.dll. , :

HKEY_CLASSES_ROOT\CLSID\{CCE5B1E5-B2ED-45D5-B09F-8EC54B75ABF4}\

InprocServer32.

#import, . jawsapi.h guids.cpp, , , " COM".

// : jawsapi.h
//   IJawsApi.
#ifndef __JAWSAPI_H__
#define __JAWSAPI_H__

#include 
#include 

#undef INTERFACE
#define INTERFACE  IJawsApi

DECLARE_INTERFACE_(IJawsApi ,IDispatch)
{
	STDMETHOD(RunScript)(THIS_ /* [in] */ BSTR ScriptName, VARIANT_BOOL* retval) PURE;
	STDMETHOD(SayString)(THIS_ /*  [in]*/ BSTR StringToSpeak,
				/*[in, optional, defaultvalue(-1)]*/ VARIANT_BOOL bFlush, VARIANT_BOOL* retval) PURE;
	STDMETHOD(StopSpeech)(THIS_ ) PURE;
	STDMETHOD(Enable)(THIS_ /*[in]*/ VARIANT_BOOL vbNoDDIHooks,
				VARIANT_BOOL* retval) PURE;
	STDMETHOD(Disable)(THIS_ VARIANT_BOOL* retval) PURE;
	STDMETHOD(RunFunction)(THIS_ /*[in]*/ BSTR FunctionName, VARIANT_BOOL* retval) PURE;
};
#endif
// : guids.cpp.
#include 
#include 
#include 

/* {CCE5B1E5-B2ED-45D5-B09F-8EC54B75ABF4} */
DEFINE_GUID(CLSID_JAWSCLASS ,
0x0CCE5B1E5, 0x0B2ED, 0x45D5,0xB0, 0x9F, 0x8E, 0x0C5, 0x4B, 0x75, 0x0AB, 0x0F4);

/* {123DEDB4-2CF6-429C-A2AB-CC809E5516CE} */
DEFINE_GUID(IID_IJAWSAPI ,
0x123DEDB4,0x2CF6, 0x429C, 0x0A2, 0x0AB, 0x0CC, 0x80, 0x9E, 0x55, 0x16, 0x0CE);

guids.cpp ( ) . jawsapi.h #include , IJawsApi. :

extern const CLSID CLSID_JAWSCLASS ;
extern const IID IID_IJAWSAPI ;

IJawsApi C++ . , JAWS.

// : main.cpp #include #include "jawsapi.h" extern const CLSID CLSID_JAWSCLASS ; extern const IID IID_IJAWSAPI ; int main () { IJawsApi* pJawsApi= NULL; CoInitialize(NULL); HRESULT hr = CoCreateInstance(CLSID_JAWSCLASS,NULL, CLSCTX_INPROC_SERVER, IID_IJAWSAPI, reinterpret_cast(&pJawsApi)); if (SUCCEEDED(hr) && pJawsApi) { VARIANT_BOOL retval; BSTR param = SysAllocString(L"SaySystemTime"); pJawsApi->RunScript(param,&retval); SysFreeString(param); } CoUninitialize(); return 0; }

Borland Builder C++ 5.5 command line tools C++- MinGW ( : -lole32 -loleaut32).



, .
: ©  ,  2004-2024