Jump to content

OLE automation: Difference between revisions

m
syntax highlighting fixup automation
(Added Wren)
m (syntax highlighting fixup automation)
Line 15:
 
client: using the ahk ole server as well as the python ole server implemented below
<langsyntaxhighlight lang="autohotkey">ahk := comobjactive("ahkdemo.ahk")
ahk.hello("hello world")
py := ComObjActive("python.server")
py.write("hello")
return</langsyntaxhighlight>
server:
<langsyntaxhighlight lang="autohotkey">#Persistent
CLSID_ThisScript := "{38A3EB13-D0C4-478b-9720-4D0B2D361DB9}"
APPID_ThisScript := "ahkdemo.ahk"
Line 76:
#include lib\ComDispTable.ahk
#include lib\ComDispatch.ahk
#include lib\ComVar.ahk</langsyntaxhighlight>
 
=={{header|Go}}==
Line 83:
<br>
This uses OLE automation to create a new Microsoft Word document, write some text to it and after 10 seconds close the document without saving and quit Word.
<langsyntaxhighlight lang="go">package main
 
import (
Line 112:
 
ole.CoUninitialize()
}</langsyntaxhighlight>
 
=={{header|M2000 Interpreter}}==
Line 118:
 
We can use Events, from declared objects and from objects that we get as result from methods, using WithEvents.
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module CheckAutomation {
ExitNow=false
Line 150:
}
CheckAutomation
</syntaxhighlight>
</lang>
 
=={{header|Phix}}==
Line 160:
Server uses a client of the ahk server above to register the clsid in the windows registry.
Translated from <tt>win32com/test/testDynamic.py</tt>
<langsyntaxhighlight lang="python">#!/usr/bin/env python
# -*- coding: utf-8 -*-
import win32com.client
Line 215:
# autohotkey.exe ahkside.ahk
# python /c/Python26/Scripts/ipython.py -wthread -i pythonside.py
# must use -wthread otherwise calling com client hangs</langsyntaxhighlight>
client
<langsyntaxhighlight Pythonlang="python">import win32com.client
client = win32com.client.Dispatch("python.server")
client.write("hello world")</langsyntaxhighlight>
 
=={{header|Wren}}==
Line 227:
{{works with|Windows 10}}
An embedded application with a Go host so we can use the Go OLE library.
<langsyntaxhighlight lang="ecmascript">/* OLE_automation.wren */
 
class Ole {
Line 282:
IUnknown.release(word)
 
Ole.coUninitialize()</langsyntaxhighlight>
<br>
We now embed this script in the following Go program and run it.
<langsyntaxhighlight lang="go">/* go run OLE_automation.go */
 
package main
Line 424:
vm.InterpretFile(fileName)
vm.Free()
}</langsyntaxhighlight>
 
{{omit from|Ada|Too involved to implement from scratch, and OS specific}}
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.