20 posts in this topic
Is there a way to read data directly from the Windows Component Object Model (COM) interface?
I am trying to make a really simple disk space reporter tool for accounts on an Active Directory domain, to read the disk quota limit for the logged on user's home directory, and report how much disk space they are currently using.
MSDN: IDiskQuotaUser interface
in un mio progetto vorrei utilizzare una dll per creare dei file excel senza utilizzare l'applicativo Excel.
Ora dalla versione 2007 di Office la Microsoft utilizza per i file un nuovo formato aperto "Microsoft Open XML format".
in PHP questo è molto semplice utilizzando la Libreria PHPExcel (http://www.codeplex.com/PHPExcel)
Cercando in rete ho trovato una dll che dovrebbe fare lo stesso (https://code.google.com/archive/p/excellibrary/) ma non ho assolutamente le capacita di integrare la Dll in autoit, qualcuno mi può aiutare ?
Sarebbe veramente molto efficiente poter creare e manipolare file excel in autoit senza dover caricare in memoria l'applicativo Excel.
in my project I want to use a dll to create the excel file without using the Excel application.
Now from the Microsoft Office 2007 version uses for the files a new open format "Microsoft Open XML format".
PHP This is very simple using the Library PHPExcel (http://www.codeplex.com/PHPExcel)
Searching the net I found a dll that should do the same (https://code.google.com/archive/p/excellibrary/) but I have absolutely the ability to integrate the .dll in autoit, anyone can help me?
It would really be very efficient to create and manipulate Excel files into memory autoit without having to load the Excel application.
I have price-list in xls. When I open it by _Excel_Open and _Excel_BookOpen and after that close by _Excel_Close, I have a message about "Save changes?"
I try open it in read-only mode, but no changes made. I still see annoing message.
Windows 10 prof, MS Office 2007.
#include <Excel.au3> #include <MsgBoxConstants.au3> ConsoleWrite(@AutoItVersion) Global $sPriceFile = @ScriptDir&"\opt_pr_list-mini.xls" Local $oExcel = _Excel_Open(False, False, False, True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, $sPriceFile, True ) ; readonly If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error opening workbook @error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf _Excel_Close($oExcel, False, True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_Close Example 2", "Error closing the Excel application." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Exit What I do wrong?
I've made a library, based on AutoItObject UDF with the goal of implementing getter and setter functionality and make it possible to define new object properties in as few steps as possible.
Thank you to @trancexx for getting me on the right track, and all users in Hooking into the IDispatch interface for the code to get me going.
If I've forgotten to add credit, please let me know
Things to be added
Garbage collection Method support Support for more/all AutoIt variable-types Accessors Inheritance equivalent of @error and @extended Example:
#include <AutoItObject_Internal.au3> $oIDispatch = IDispatch() $__getter = DllCallbackRegister(CustomGetter, "long", "IDispatch;IDispatch") $__setter = DllCallbackRegister(CustomSetter, "long", "IDispatch;IDispatch") $oIDispatch.__defineGetter("a", $__getter) $oIDispatch.__defineSetter("a", $__setter) $oIDispatch.a = "start" MsgBox(0, "", $oIDispatch.a) $oIDispatch.a = "end" MsgBox(0, "", $oIDispatch.a) $oIDispatch.b = 3.14 $oIDispatch.b += $oIDispatch.b MsgBox(0, "", $oIDispatch.b) $oIDispatch.__defineMethod("c", FuncName(MsgBox)) $oIDispatch.c(0, "title", "text") Func CustomGetter($oIDispatch, $oIDispatch2);(return.value, this.value) $oIDispatch.a = "_" & $oIDispatch2.a & "_" EndFunc Func CustomSetter($oIDispatch, $oIDispatch2);(this.value, caller.value) $oIDispatch.a &= $oIDispatch2.a EndFunc
I've coded the small script below, but it can't seem to get the instance of Windows Media player as it keeps going to @error, I've not used com objects before so any assistance would be appreciate. I already have WMP open and minimised. I retrieved "WMPlayerApp" from the AutoIT info tool, I've included a copy below.
I'm using these sources:
$oWMP = ObjGet("", "WMPlayerApp") If @error Then MsgBox(0, "Can't get WMP", "Couldn't connect to the WMP instance") Exit EndIf $wmpPlayState = $oWMP.playState MsgBox(0, "Play State", $wmpPlayState) $wmpSongName = $oWMP.currentMedia.name MsgBox(0, "Play State", $wmpSongName) I've also seen references to the below, but I want to get an existing open WMP:
ObjCreate("wmplayer.OCX") and have looked at the WMP.udf but can't see how it will do either of the functions I've coded above.