forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Bridge to OLE Automation

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements
View previous topic :: View next topic  
Author Message
OCTAGRAM
Newbie


Joined: 03 Feb 2019
Posts: 2
Location: Saint Petersburg, Russia

PostPosted: Tue Feb 26, 2019 7:39 am    Post subject: Bridge to OLE Automation Reply with quote

http://www.vdsworld.com/search.php?view_mode=fileinfo&file_id=519
https://osdn.net/projects/vds-ole-bridge/

This project is having little attention despite hanging in the most recent files on main page, so I decided to introduce what a game changer it is.

For features you lack out of box previously you had to use dedicated VDS extension, not suitable for any other product. Or you could use procedural DLL. But I haven't seen for years people making libraries this way.

OLE Automation is how libraries are interfaced to another programming languages. Windows 2000 or around introduced Windows Scripting Host with VBScript and JScript, and they all have ability to manipulate OLE Automation objects. Lots of OS features are exposed via WMI (Wbem etc.). For instance, I was enumerating network IPs and reconfiguring RDP server via WMI, in JScript. VBScript communities contain lots of recipes.

My VDS extension rejoins these worlds. Now Visual DialogScript can be a client of OLE Automation too. If there was a task you couldn't solve in VDS, try to look for "VBScript your-task-description", find if there is an OLE Automation class library for this task. OLE Automation bridge makes all the same libraries callable from VDS.

Windows seems to have means for interfacing any .NET assembly to OLE Automation. I have little knowledge about .NET, but I can see this is the way WinSCP gets interfaced to OLE Automation. I had success with using WinSCP from Visual DialogScript, following these steps:
https://winscp.net/eng/docs/library_install#registering

If there is some another .NET assembly, its author could probably miss writing these instructions, but you can try to apply all the same steps to your .NET assembly.

I hope it helps someone.

_________________
If you want to get to the top, you have to start at the bottom
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Feb 27, 2019 4:23 am    Post subject: Reply with quote

This seems to have a lot of promise, but iI'm having a bit of trouble connection to 'Excel.Application'.

So the goals are

Connect Excel.Application
Add workbook (workbooks.add)
Set a cell as a range (activeworkbook.range("a1")
And set the range to a value (.value = 16)

Any way you can step through the example?

Thanks,

Brandon
Back to top
View user's profile Send private message AIM Address
OCTAGRAM
Newbie


Joined: 03 Feb 2019
Posts: 2
Location: Saint Petersburg, Russia

PostPosted: Wed Feb 27, 2019 12:57 pm    Post subject: Reply with quote

MS Office accessible from OLE Automation is independent from the open one if any. These are additional invisible instances. I enumerated opened files only to find out there are always none.

So you need to create (invisible) Excel application object, open new document, perform some actions, save document. Otherwise there are no visible traces of activity. One nasty thing about MS Office is that its invisible instances don't quit unless they receive Quit command, and if they don't quit, they keep file locks that only Task Manager can release. Try to not shutdown the visible Excel instance you may have important unsaved documents in. At least, that's how Office 2007 worked.

That is going to be something like:

Code:
#DEFINE COMMAND, OLE
#DEFINE FUNCTION, OLE
EXTERNAL VDSOLEAUT.DLL,ignored

%E = @OLE(variant, Excel.Application, OBJECT)
%W = @OLE(variant, %E, GET, variant, Workbooks)
%D = @OLE(variant, %W, DO, variant, Add)
OLE CLOSE, variant, %W
%S = @OLE(variant, %D, GET, variant, ActiveSheet)
%R = @OLE(variant, %S, GET, variant, Range, a1, STRING)
OLE MODIFY, variant, %R, PUT, Value, 16, INTEGER
OLE CLOSE, variant, %R


OLE CLOSE, variant, %S
OLE INVOKE, variant, %W, DO, SaveAs, Hello.xlsx, STRING
OLE INVOKE, variant, %W, DO, Close
OLE CLOSE, variant, %D
OLE INVOKE, variant, %E, DO, Quit
OLE CLOSE, variant, %E

_________________
If you want to get to the top, you have to start at the bottom
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Sun Aug 16, 2020 1:41 pm    Post subject: Reply with quote

I've got other tools now in the RPA realm, but with hindsight this right here is extremely valuable in that someone could make a valuable RPA tool.

My thought is, connect to excel for dataset, connect to internet explorer for data input or additional datasets, then use window send etc. to input data into window based tools.

Again, great job with this.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group