 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Thu Dec 06, 2007 1:42 pm Post subject: |
|
|
| Joy2DWorld wrote: | | also tried variants of (objword, "Documents=", "Open) |
So, problem was solved or not? If not, I guess what you want is this:
| Code: | COM_Init()
objWord := COM_CreateObject("Word.Application")
COM_Invoke(objWord, "Visible=", "True")
COM_Invoke(COM_Invoke(objWord, "Documents"), "Open", "C:\test.doc")
|
|
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1205 Location: USA
|
Posted: Thu Dec 06, 2007 1:45 pm Post subject: |
|
|
Tested:
| Code: | com_CoInitialize()
objWord := com_CreateObject("Word.Application")
com_invoke(objWord,"Visible=",True)
Docs := com_invoke(objWord,"Documents")
com_invoke(Docs,"Open","c:\blah.doc")
|
_________________
 |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1205 Location: USA
|
Posted: Thu Dec 06, 2007 1:46 pm Post subject: |
|
|
Sean beat me. _________________
 |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Thu Dec 06, 2007 2:28 pm Post subject: |
|
|
ok,
1. THANKS!! for all the guidance....
2. Can nominate me for month's bonehead coding award...
| Quote: | Invoke(pdisp, sName, arg1="vT_NoNe",arg2="vT_NoNe",arg3="vT_NoNe",arg4="vT_NoNe",
arg5="vT_NoNe",arg6="vT_NoNe",arg7="vT_NoNe",arg8="vT_NoNe",
arg9="vT_NoNe") {
Com_Invoke(pdisp, sName, arg1 ,arg2 ,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
} |
was the bonehead source of all my woes.....
ie... not very effective way to get back invoke handle!! _________________ Joyce Jamce
Last edited by Joy2DWorld on Mon Dec 17, 2007 5:03 pm; edited 1 time in total |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Mon Dec 17, 2007 1:08 pm Post subject: |
|
|
I'd like to suggest a change to COM_QueryService:
Do not reuse ppv (the function parameter) as an output variable in the DllCall.
If IServiceProvider.QueryService fails for whatever reason, currently COM_QueryService returns whatever pointer it was given. Using a "dedicated" variable would automatically mean COM_QueryService would return 0 on failure.
@Joy2DWorld: would you mind editing that quote (adding spaces) so it doesn't stretch the page? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Mon Dec 17, 2007 1:51 pm Post subject: |
|
|
| lexikos wrote: | | If IServiceProvider.QueryService fails for whatever reason, currently COM_QueryService returns whatever pointer it was given. |
It's updated. There have been other cosmetic modifications too.
Have you ever experienced the same problem with QueryInterface? I had expected the same behavior with QueryService. BTW, strangely, I found that it was already modified in my custom version, but not in COM.ahk. |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 422 Location: Galil, Israel
|
Posted: Mon Dec 17, 2007 5:09 pm Post subject: |
|
|
| lexikos wrote: | | @Joy2DWorld: would you mind editing that quote (adding spaces) so it doesn't stretch the page? |
done,
try this java scriptlet...
| Code: | <script language=javascript>
var imgAR,imgNm,txtWrap,ocWidth,isFixed;
if(imgAR==undefined) imgAR=new Array();
if(imgNm==undefined) imgNm=0;
if(!isFixed){
fixPage();
isFixed=1;
}
else{
restoreImage();
isFixed=0;
}
if(alphaB=='1'){
attachEvent('onbeforeprint',function(){for(i=0; i<=imgNm-1; i++) removeAlpha(imgAR[i])});
attachEvent('onafterprint',function(){for(i=0; i<=imgNm-1; i++) restoreAlpha(imgAR[i])});
attachEvent('onunload',removeEvtHandler);
}
attachEvent('onresize',function(){setTimeout('if(bodyWidth()!=ocWidth&&isFixed) fixPage()',0)});
function fixPage(){
scrollBy(1000,0);
exWidth=document.body.scrollLeft?document.body.scrollLeft:document.documentElement.scrollLeft;
if(exWidth>0){
scrollBy(-1000,0);
threshold=0.75*bodyWidth();
for(i=0; i<=document.images.length-1; i++){
var img=document.images[i];
var obj=img.parentElement.tagName!='A'?img:img.parentElement;
img.osWidth=obj.parentElement.offsetWidth-obj.offsetWidth;
if(img.osWidth<0||obj.parentElement.tagName=='BODY') img.osWidth=20;
if(img.width>threshold||img.width>600){
if(!img.oWidth){
img.oWidth=img.width;
img.oHeight=img.height;
if(!img.currentStyle.filter){
img.width=img.oWidth;
img.height=img.oHeight;
if(alphaB=='1'){
img.oSrc=img.src;
img.src=imgSrc;
img.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.oSrc+'\',sizingMethod=\'scale\')';
img.ondragstart=function(){removeAlpha(event.srcElement)};
img.oncontextmenu=function(){removeAlpha(event.srcElement)};
img.onmouseout=function(){restoreAlpha(event.srcElement)};
}
}
imgAR[imgNm]=img;
imgNm++;
}
if(img.width>exWidth+20) img.width=img.width-exWidth-20;
else img.width=50;
}
}
if(!txtWrap){
wrapText(document.body);
txtWrap=1;
}
}
resizeImage();
ocWidth=bodyWidth();
}
function wrapText(obj){
if(obj.nodeType==3){
bPos=obj.data.search(/\S{35}/);
if(bPos>=0){
nObj=obj.splitText(bPos+35);
obj.parentNode.insertBefore(document.createElement('WBR'),nObj);
}
}
else if(obj.tagName!='STYLE'&&obj.tagName!='SCRIPT'){
for(var j=0; cobj=obj.childNodes[j]; j++) wrapText(cobj);
}
}
function resizeImage(){
for(i=0; i<=imgNm-1; i++){
var y=imgAR[i].parentElement.tagName!='A'?imgAR[i]:imgAR[i].parentElement;
var z=y.parentElement;
newWidth=(z.clientWidth?z.clientWidth:z.offsetWidth)-imgAR[i].osWidth;
if(newWidth==imgAR[i].width&&ocWidth!=undefined&&bodyWidth()>ocWidth) newWidth=imgAR[i].width+bodyWidth()-ocWidth;
if(newWidth>imgAR[i].oWidth) newWidth=imgAR[i].oWidth;
imgAR[i].width=newWidth;
imgAR[i].height=imgAR[i].oHeight*newWidth/imgAR[i].oWidth;
}
}
function restoreImage(){
for(i=0; i<=imgNm-1; i++){
imgAR[i].width=imgAR[i].oWidth;
imgAR[i].height=imgAR[i].oHeight;
}
}
function removeAlpha(x){
if(x.src.indexOf('FixWidePage.gif')!=-1){
x.src=x.oSrc;
x.oSrc=imgSrc;
}
}
function restoreAlpha(x){
if(x.style.filter.indexOf(x.src)!=-1){
x.oSrc=x.src;
x.src=imgSrc;
}
}
function removeEvtHandler(){
for(i=0; i<=imgNm-1; i++){
imgAR[i].oncontextmenu='';
imgAR[i].ondragstart='';
imgAR[i].onmouseout='';
}
}
function bodyWidth(){
return(document.body.clientWidth?document.body.clientWidth:document.documentElement.clientWidth)
}
</script> |
_________________ Joyce Jamce |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Tue Dec 18, 2007 1:27 am Post subject: |
|
|
| Sean wrote: | | It's updated. | Thanks.
| Quote: | | Have you ever experienced the same problem with QueryInterface? | No. I guess I've never queried for an interface that wasn't present, or more likely, QueryInterface set a default value for the output parameter. I suppose it's really up to the programmer of the interface.
I only noticed it with QueryService because it fails for Internet Explorer (from the accessible object) if no page has loaded yet. I was getting back a pointer to the accessible object rather than a window object (or null), so AutoHotkey would crash as soon as I tried to Invoke.
Thanks. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Tue Dec 18, 2007 2:20 am Post subject: |
|
|
| lexikos wrote: | | I guess I've never queried for an interface that wasn't present, or more likely, QueryInterface set a default value for the output parameter. I suppose it's really up to the programmer of the interface. |
It should be in QueryInterface case as it's documented, although NULL doesn't necessarily mean zero:
| Quote: | | If the object does not support the interface specified in iid, *ppvObject is set to NULL. |
I didn't expect all authors would follow the documentation strictly, however, I haven't faced an exception to returning zero as far as I can recall. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Sun Dec 23, 2007 2:49 am Post subject: |
|
|
Any idea why SetFormat, Integer, H breaks Invoke?
| Code: | COM_Init()
doc := COM_CreateObject("{25336920-03F9-11CF-8FD0-00AA00686F13}")
COM_Invoke(doc, "write", "test")
body_D := COM_Invoke(doc, "body")
SetFormat, Integer, H ; (I originally set the format for something unrelated)
body_H := COM_Invoke(doc, "body")
MsgBox % "D:" body_D ", H:" body_H |
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Dec 23, 2007 9:12 am Post subject: |
|
|
| lexikos wrote: | | Any idea why SetFormat, Integer, H breaks Invoke? |
I believe it's because of |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Dec 23, 2007 9:12 am Post subject: |
|
|
I was in a hurry at the time. Do you want me to modify COM.ahk, or Chris to change the current behavior of A_Index? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Sun Dec 23, 2007 12:11 pm Post subject: |
|
|
| COM_Invoke()/COM_Invoke_() are updated to not depend on the format of integer. And, the argument's indices are changed from 1-based to 0-based. I hope that _TEMP_VT_BYREF_ haven't been used much. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1338
|
Posted: Thu Jan 10, 2008 3:21 am Post subject: |
|
|
| Added missing nParams := 10 to COM_Invoke()/COM_Invoke_(). |
|
| Back to top |
|
 |
nnesori
Joined: 14 Oct 2006 Posts: 15 Location: south korea
|
Posted: Wed Feb 13, 2008 2:02 pm Post subject: GOMX PROPERTYPUT does not work. (With COM.ahk) |
|
|
GOM is a FREE media player with popular audio & video codecs built-in.
( http://www.gomplayer.com/main.html)
and GOMX is ActiveX Lib.
I tried below script.
PROPERTYGET works well.
but PROPERTYPUT doesn't work.
Can someone help me, please.
| Code: |
COM_AtlAxWinInit()
Gui, +LastFound
Gui, Show , W500 H350 ,MyGomPlayer
hwnd:=WinExist("MyGomPlayer")
pdsp:=Gom_Add(hWnd, 0, 0, 500, 350)
if(pdsp=""){
msgbox, Error. ( GOMX not found! )
Exit
}
msgbox % "ver=" . COM_Invoke(pdsp,"Version")
COM_Invoke(pdsp,"Url=","d:\sumo07.avi") ;<-----_hResult_= -2147352569 (DISP_E_NONAMEDARGS)
msgbox % COM_Invoke(pdsp,"Url")
COM_Invoke(pdsp,"Play")
Return
GuiClose:
Gui,Destroy
COM_Release(pdsp)
COM_AtlAxWinTerm()
ExitApp
return
Gom_Add(hWnd, x, y, w, h)
{
Return, COM_AtlAxGetControl(COM_AtlAxCreateContainer(hWnd, x, y, w, h, "GOMX.GomXCtrl.1"))
}
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|