r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Windows/COM Support]

Anton
1-Mar-2008
[389]
You're welcome, James.
GiuseppeC
3-Mar-2008
[390]
Added to REBOL2 Projects on DocBase.
Graham
3-Jun-2008
[391x5]
Anton, can you see anything wrong with this ... crashes Rebol

rebol []


; download the skype4com dll from https://developer.skype.com/Docs/Skype4COM/Start
; and register the library
; regsvr32 skype4com.dll

; example of using sms
; https://developer.skype.com/Docs/Skype4COMLib/Sms_vbs

COMlib: do %comlib.r
COMlib/initialize

do bind [
	oSkype: CreateObject "Skype4COM.Skype" 

 oSMS: GetObject [ oSkype ".SendSms( %s, %s)" "+12345679" "Hello!" 
 ]

] COMlib/api

This should send a SMS using the Skype installed on your PC.
However, the getObject will invariably crash Rebol on Vista.
On Windows 2K, a SMS is sent, but it's just garbage
You shouldn't need to register the skype4com.dll as it is normally 
registered with Skype.
Using %S expects a unicode string
Dockimbel
3-Jun-2008
[396]
Try by putting a null character at the end of all strings passed 
to the COMlib ?
Graham
3-Jun-2008
[397x4]
I wondered about that ...
Curiously Anton's examples sending normal strings to MS Word and 
Excel work fine.
are null terminated strings like this

+12345679^(00)
 "Hello!(^(00)"
or
+12345679^(null)
 "Hello!^(null)"

?
or is it #"^@"  ?
Anton
3-Jun-2008
[401x4]
Each of those way of writing null char are equivalent.
Each type of COM object may support different string encodings, I 
think. We'll have to look up what type of encoding Skype supports.
It's quite possible these days that it doesn't take ascii.
(And COMLib has no string conversion support functions at the moment 
- you'll have to do any string conversions yourself.)
Graham
3-Jun-2008
[405x3]
What about using sprintf, and feeding the c string to skype instead 
( http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=printf.r
)
Just checked on XP .. send sms also sends garbage.  I can see the 
message it is trying to send in Skype and it is garbage there too. 
 So, presumably the way strings are being sent via the comlib is 
not correct for Skype.
I posted a question on the Skype API forums ... not that I am expecting 
a reply :(
Graham
5-Jun-2008
[408]
https://developer.skype.com/jira/browse/SPA-559


They have assigned someone to look at the problem.  Since comlib 
works with other applications, there must be something odd with the 
way Skype is different string parameters.  Or, there is a bug in 
the way Rebol strings are converted to BSTR strings.
Anton
6-Jun-2008
[409x2]
The bug is more likely on our side.
(that's my guess, anyway)
Graham
6-Jun-2008
[411x3]
I found two more SMS providers with a COM interface.  They both work 
with the comlib.
Both Australian based it seems
ie. I can use their dlls to send SMS messages.
Anton
6-Jun-2008
[414]
Ok... Skype now looks more particular than COMLib, then.
Graham
9-Jun-2008
[415]
Using the international string format for cellphone numbers and XP, 
I can now send messages with the latest version of Skype.  Still 
crashes on Vista though.
Graham
12-Jun-2008
[416x6]
COMlib: do %comlib.r
COMlib/initialize

if error? set/any 'err try [
	do bind [
		oSkype: CreateObject "Skype4COM.Skype"
		if -1 <> res: GetInteger [oSkype "Client.IsRunning"] [
			CallMethod [oSkype "Client.Start()"]
		]

  cUserStatus_Offline: GetInteger [oSkype ".Convert.TextToUserStatus(%s)" 
  "OFFLINE"]
	] COMlib/api
] [
	probe mold disarm err
]
Gives this error
Script: "COMLib (the rebol side of the com2rebol interface)" (9-Mar-2007)
{make object! [
    code: 800
    type: 'user
    id: 'message
    arg1: {Member:^^-  .Convert.TextToUserStatus(%s)
Function:^^-  getInteger^^-^^-
Error In:^^-  InvokeArray
Error:^^-  Unspecified error
Code:^^-  80004005
Source:^^-  IDispatch Interface}
    arg2: none
    arg3: none

    near: [GetInteger [oSkype ".Convert.TextToUserStatus(%s)" "OFFLINE"]]
    where: none
]}
Ok, I have this observation.  I get crashes or errors with using 
the getInteger command when passing a string parameter to the skype4com 
dll.  I don't get an error if I don't pass a parameter.  I don't 
get errors when passing strings to Getobject.  I also don't get errors 
passing strings to getInteger to other dlls.  Just Skype.
now with the same library ( I think ), I also didn't get an error 
under XP and using Benjamin's getNumber version.
Dunno if any of that helps.
xavier
12-Jun-2008
[422x2]
hello, i m working on a programm that must interact with outlook 
and the number dialer of windows ... can someone tell me where do 
i have to look for documentation on it ? does anybody already did 
it ?
i just found the site of anton i go to read all that, it looks like 
what i wanted :)
Gregg
12-Jun-2008
[424]
I've used rasdial very successfully under Windows Xavier.
Robert
30-Oct-2008
[425]
How can I set the current directory as the active one when I create 
an XLS object with COMLib? At the moment I need to provide fully-qualified-filenames 
to open a file.
Anton
30-Oct-2008
[426x3]
Robert, are you talking about COMLib-anton ?
If so, there was a problem that really bugged me, which I couldn't 
find a good way to avoid. That is, the current directory would be 
where the com2rebol.dll was (or something like that). So you can 
see the demos have to reference files relative to the parent directory.
But I can see in the word-open-save.r demo I have done this:

	do/args %../COMLib.r [
		...

  word_doc: GetObject [word_obj ".Documents.Open(%s)" to-local-file 
  clean-path %demos/word-open.doc]
Robert
30-Oct-2008
[429x2]
Anton, yes.
I solved it the same way with to-local-file works, but not elegant.
Anton
4-Nov-2008
[431]
Yes, not elegant. I'm sorry.
Graham
20-Nov-2008
[432x2]
Anton, how would one do the example here 

http://www.oooforum.org/forum/viewtopic.phtml?t=9815&postdays=0&postorder=asc&start=0

In particular, this line

Set doc = Stardesktop.loadComponentFromURL("private:factory/swriter", 
"_blank", 0, args)

where args has been defined as Dim args()
the func is described here http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html
james_nak
22-Nov-2008
[434]
Is it possible to write a windows "service" (a program running as 
a service) with rebol?
Graham
22-Nov-2008
[435x2]
doc has software to do this
it's part of the Cheyenne distribution
james_nak
22-Nov-2008
[437]
Thanks Graham.
Dockimbel
22-Nov-2008
[438]
Windows Services support: http://softinnov.org/rebol/nt-services.shtml