maniootek Posted March 10, 2020 Author Posted March 10, 2020 4 minutes ago, Danyfirex said: yes I wrote it wrong. You're right. but even this code generate error: Local $t=DllStructCreate("long[3]") DllStructSetData($t,1,3) if @error then MsgBox(0,0, "1. error=" & @error) DllStructSetData($t,2,4) if @error then MsgBox(0,0, "2. error=" & @error) DllStructSetData($t,3,5) if @error then MsgBox(0,0, "3. error=" & @error) 4 minutes ago, Danyfirex said: Probably I can help you. I'll send a PM. Ok I wait for the details
maniootek Posted March 12, 2020 Author Posted March 12, 2020 (edited) Together with @Danyfirex help, we stuck on this code: expandcollapse popup#include "SafeArray.au3" Global Const $sIID_ISuDokument = "{B87D03F2-9801-483C-AF9E-B00C2532226E}" Global $sTagISuDokument = "" ;Build Dummy Interface Methods For $i = 1 To 200 If $i = 11 Then $sTagISuDokument &= "Wyswietl" & " hresult(bool);" ContinueLoop EndIf If $i = 184 Then $sTagISuDokument &= "NaPodstawieWielu" & " hresult(ptr*);" ContinueLoop EndIf $sTagISuDokument &= "Method" & $i & " hresult();" Next ConsoleWrite($sTagISuDokument & @CRLF) NaPodstawieWielu() Func NaPodstawieWielu() Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oInsertGT = ObjCreate("Insert.GT") $oInsertGT.Produkt = 1 $oInsertGT.Wczytaj("C:\ProgramData\InsERT\InsERT GT\Subiekt.xml") Local $oSubiekt = $oInsertGT.Uruchom(Int(0x0), Int(0x2 + 0x4)) _Log("IsObj($oSubiekt): " & IsObj($oSubiekt)) $oSubiekt.Okno.Widoczne = True Local $oDokument = $oSubiekt.SuDokumentyManager.DodajFSz _Log("IsObj($oDokument): " & IsObj($oDokument)) Local $oNewDokument = ObjCreateInterface($oDokument, $sIID_ISuDokument, $sTagISuDokument) _Log("IsObj($oNewDokument): " & IsObj($oNewDokument)) _Log("$oDokument=$oNewDokument: " & ($oDokument = $oNewDokument)) _Log("ObjName($oDokument): " & ObjName($oDokument)) _Log("ObjName($oNewDokument): " & ObjName($oNewDokument)) _Log("ObjName($oDokument): " & ObjName($oDokument, 6)) _Log("ObjName($oNewDokument): " & ObjName($oNewDokument, 6)) _Log("ObjName($oDokument): " & ObjName($oDokument, 7)) _Log("ObjName($oNewDokument): " & ObjName($oNewDokument, 7)) _Log("$oDokument(): " & $oDokument()) _Log("$oNewDokument(): " & $oNewDokument()) Local $pArray = SafeArrayCreateVector("int", 3) ;create Safe Array Tab SafeArrayPutElement($pArray, 0, 3066501) ;Add Number SafeArrayPutElement($pArray, 1, 3069099) ;Add Number SafeArrayPutElement($pArray, 2, 3029792) ;Add Number $oNewDokument.NaPodstawieWielu($pArray) Local $bRet = 0 $oNewDokument.Wyswietl($bRet) _Log("$oNewDokument.Wyswietl: " & $bRet) SafeArrayDestroy($pArray) ;free Array EndFunc ;==>NaPodstawieWielu Func _Log($sString) ConsoleWrite($sString & @CRLF) EndFunc ;==>_Log ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc We are trying to create document (FSz) which is group of other documents (ids 3066501, 3069099, 3029792) with .NaPodstawieWielu method which require LONG datatype array as parameter. After that method we use .Wyswietl method which show document but it never appear. We tried with other type of document (FS) and .Wyswietl worked (document appeared). Looks like .NaPodstawieWielu does not work proper way (the part with array as parameter). Any help/tips/advice is much appreciated 🥺🙏 Edited March 12, 2020 by maniootek
junkew Posted March 15, 2020 Posted March 15, 2020 Can you make it work as a demo in vba excel or just vbscript? Try dictionary or collection of longs and pass that. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
maniootek Posted March 15, 2020 Author Posted March 15, 2020 54 minutes ago, junkew said: Can you make it work as a demo in vba excel or just vbscript? I don't know other languages. 55 minutes ago, junkew said: Try dictionary or collection of longs and pass that. How can I make collection of longs? Can you give me some example?
junkew Posted March 15, 2020 Posted March 15, 2020 Your first example given is vba Open excel Alt f11 will bring you to vba editor Copy paste your first vba example and see if it runs. Probably you have to make a reference to your dll first. Is there any english help file as things I googled seem all to be in po l ish. Tell a little more about the program and open links on googleinternet so we can try to help. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
maniootek Posted March 16, 2020 Author Posted March 16, 2020 16 hours ago, junkew said: Your first example given is vba Open excel Alt f11 will bring you to vba editor Copy paste your first vba example and see if it runs. Probably you have to make a reference to your dll first. VBA is working good. 16 hours ago, junkew said: Is there any english help file as things I googled seem all to be in po l ish. Tell a little more about the program and open links on googleinternet so we can try to help. No english help file and very hard to make test enviroment (need sql database filled with data and alot of configuration) 22 hours ago, junkew said: Try dictionary or collection of longs and pass that. Can you give me example?
junkew Posted March 16, 2020 Posted March 16, 2020 1.If vba is working share the working and validated version 2.Retrieve the vba created document from autoit 3.Retrieve the array of longs to see what type it is. 4. Based on 3 determine approach how to continue. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now