Page 1 of 1

Running as admin breaks COM interaction

Posted: 07 Dec 2019, 08:45
by ardent246
Anyone know why running a script as admin prevents my comobject from working?

The following code works perfect if I run the script not as admin:

Code: Select all

F2::
oWord := ComObjActive("Word.Application")
oWord.Selection.PageSetup.LineNumbering.Active := 1
oWord := ""
return
If I run the script as an admin either by right clicking the AHK file or by putting the code below into my script the code above does not work anymore.

Code: Select all

If not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}
Thanks!

Re: Running as admin breaks COM interaction

Posted: 07 Dec 2019, 08:57
by boiler
It should work if Word is also run as admin.