Jump to content

Recommended Posts

  • Replies 766
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon. 3.3.7.21 (6th Novem

Valik, Please do not tar us all with the same brush - it is a very small (albeit vocal) minority who are doing that. The rest of us are extremely grateful for the work that has been done to get the

I can clearly remember the similar situation in past when developers removed StringAddThousandsSep() from standard UDFs just because of too much bug fix requests. I use this (latest one) function in s

Posted Images

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.7.17 (20th September, 2011) (Beta)

AutoIt:

- Added: DllCallAddress() now has an example.

- Added: Example and incomplete documentation for ObjCreateInterface().

- Fixed #1660: Crash on Mod() with a divisor of 0.

- Fixed: COM methods no longer change the type of AutoIt variables.

UDFs:

- Fixed #2009: Incorrect styles listed in _GUICtrlToolbar_Create().

- Fixed #1009: SQLite library needs to support a user-defined callback for diagnostic messages instead of hard-coding ConsoleWrite().

Au3Check:

- Fixed #1934: #ForceRef after a single-line If statement ending with a single keyword would cause an incorrect error to be displayed.

3.3.7.16 (20th September, 2011) (Beta)

- This version was released but immediately pulled due to an error. See 3.3.7.17 for changes.

Report issues here.

Download here.

Edited by Valik
Link to post
Share on other sites

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.7.18 (26th September, 2011 (Beta)

AutoIt:

- Added #1947: CHM help files now have a Forward button.

- Added #1813: Better cross referencing for Int() and Mod().

- Added: Something resembling complete documentation for ObjCreateInterface().

- Fixed: IE click action on a form submit button works again.

UDFs:

- Added #1890: Better cross-referencing for _WinAPI_GetParent() and _WinAPI_GetAncestor().

- Fixed #1975: IE.au3 used old names returned from ObjName(). Fixes _IELoadWait() hang.

- Fixed #1933: URL used in _GetIP() was out-of-date.

- Fixed #2001: Example for _GUICtrlToolbar_SetButtonText() did not work correctly.

- Fixed #1994: Documentation for _ScreenCapture_Capture() and _ScreenCapture_CaptureWnd() incorrectly stated the functions had no return value. Moved information from Remarks up to Return area.

- Fixed #1948: Documentation for _GUICtrlButton_SetImage() had the wrong description.

- Fixed #1985: _IECreate() now ensures focus is given to the document when an about URI is loaded (such as about:blank). IE9 gives focus to the URL bar which can cause later issues setting focus to elements.

- Changed: _IEFormElementSetValue() examples #3 removed (login to Hotmail).

- Changed: _IEFormElementSetValue() examples #4 and #5 (now #3 and #4) use the text input instead of the file input. The file input is read-only on IE9 so the Send()/ControlSend() produced no results.

ObjCreateInterface() now has documentation. Test it out! Report any bugs, questions, et cetera so we can get it finalized.

Report issues here.

Download here.

Edited by Valik
Link to post
Share on other sites

Pay attention here if interested about ObjCreateInterface(). I'll make small demonstration of the usage that shows current "issues".

#include <WinApi.au3>
 
;===============================================================================
#interface "IPersist"
Global Const $sIID_IPersist = "{0000010c-0000-0000-C000-000000000046}"
; Definition
Global $tagIPersist = "GetClassID hresult(ptr*);"
;===============================================================================
 
;===============================================================================
#interface "IPersistFile"
Global Const $sIID_IPersistFile = "{0000010b-0000-0000-C000-000000000046}"
; Definition
Global $tagIPersistFile = $tagIPersist & _
  "IsDirty hresult();" & _
  "Load hresult(wstr;dword);" & _
  "Save hresult(wstr;bool);" & _
  "SaveCompleted hresult(wstr);" & _
  "GetCurFile hresult(ptr*);"
;===============================================================================
 
;===============================================================================
#interface "IShellLinkW"
Global Const $sCLSID_ShellLink = "{00021401-0000-0000-C000-000000000046}"
Global Const $sIID_IShellLinkW = "{000214F9-0000-0000-C000-000000000046}"
; Definition
Global Const $tagIShellLinkW = "GetPath hresult(ptr;int;ptr*;dword);" & _
  "GetIDList hresult(ptr*);" & _
  "SetIDList hresult(ptr);" & _
  "GetDescription hresult(ptr;int);" & _
  "SetDescription hresult(wstr);" & _
  "GetWorkingDirectory hresult(ptr;int);" & _
  "SetWorkingDirectory hresult(wstr);" & _
  "GetArguments hresult(ptr;int);" & _
  "SetArguments hresult(wstr);" & _
  "GetHotkey hresult(word*);" & _
  "SetHotkey hresult(word);" & _
  "GetShowCmd hresult(int*);" & _
  "SetShowCmd hresult(int);" & _
  "GetIconLocation hresult(ptr;int;ptr*);" & _
  "SetIconLocation hresult(wstr;int);" & _
  "SetRelativePath hresult(wstr);" & _
  "Resolve hresult(hwnd;dword);" & _
  "SetPath hresult(wstr);"
;===============================================================================
 
;===============================================================================
#interface "IPropertyStore"
Global Const $sIID_IPropertyStore = "{886d8EEB-8CF2-4446-8D02-CDBA1DBDCF99}"
; Definition
Global Const $tagIPropertyStore = "GetCount hresult(dword*);" & _
  "GetAt hresult(dword;ptr*);" & _
  "GetValue hresult(ptr;variant*);" & _
  "SetValue hresult(ptr;variant*);" & _
  "Commit hresult();"
;===============================================================================
 
Global Const $S_OK = 0
Global Const $sPKEY_Title = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2"
 
;-------------------------------------------------------------------------------
; Error monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc
;-------------------------------------------------------------------------------
 
;-------------------------------------------------------------------------------
; IShellLink interface object
Local $oShellLink = ObjCreateInterface($sCLSID_ShellLink, $sIID_IShellLinkW, $tagIShellLinkW)
; Costumize
$oShellLink.SetPath(@DesktopDir & "\ImaginaryFileOrWhatever.ext") ; just to test
$oShellLink.SetArguments('"' & @ScriptName & '"') ; something
$oShellLink.SetIconLocation("shell32.dll", -10) ; for example
$oShellLink.SetWorkingDirectory(@ScriptDir) ; ...
$oShellLink.SetDescription("Bzzzz...") ; ...
; Read set description for practice
Local $tDesc = DllStructCreate("wchar[64]")
$oShellLink.GetDescription(DllStructGetPtr($tDesc), DllStructGetSize($tDesc)/2)
; Print it
ConsoleWrite("--->Description = " & DllStructGetData($tDesc, 1) & @CRLF)
;-------------------------------------------------------------------------------
 
;-------------------------------------------------------------------------------
; QueryInterface for IPersistFile interface object
Local $tIID_IPersistFile = _WinAPI_GUIDFromString($sIID_IPersistFile)
Local $pPersistFile
$oShellLink.QueryInterface(DllStructGetPtr($tIID_IPersistFile), $pPersistFile)
; Make the object with IPersistFile interface
Local $oPersistFile = ObjCreateInterface($pPersistFile, $sIID_IPersistFile, $tagIPersistFile)
; Use it to save ShellLink item to disk
$oPersistFile.Save(@DesktopDir & "\zz.lnk", True)
; Check what's current file (for practice)
Local $pCurFile
$oPersistFile.GetCurFile($pCurFile)
Local $sCurFile = DllStructGetData(DllStructCreate("wchar Name[" & _WinAPI_PtrStringLenW($pCurFile) & "]", $pCurFile), "Name")
_WinAPI_CoTaskMemFree($pCurFile) ; documentation for GetCurFile method is very specific about releasing
; Print the result of the query
ConsoleWrite("> CurFile = " & $sCurFile & @CRLF)
;-------------------------------------------------------------------------------
 
;-------------------------------------------------------------------------------
; QueryInterface for IPropertyStore interface object
Local $tIID_IPropertyStore = _WinAPI_GUIDFromString($sIID_IPropertyStore)
Local $pPropertyStore
$oShellLink.QueryInterface(DllStructGetPtr($tIID_IPropertyStore), $pPropertyStore)
; Make the object with IPropertyStore interface
Local $oPropertyStore = ObjCreateInterface($pPropertyStore, $sIID_IPropertyStore, $tagIPropertyStore)
; Title
Local $tPKEY_Title = _WinAPI_PKEYFromString($sPKEY_Title)
; Set it
$oPropertyStore.SetValue(DllStructGetPtr($tPKEY_Title), "Testing title")
; Read set
Local $vVal = 0 ; GetValue method will use it as [out].
$oPropertyStore.GetValue(DllStructGetPtr($tPKEY_Title), $vVal)
; Print
ConsoleWrite("--->Title = " & $vVal & @CRLF)
;-------------------------------------------------------------------------------
 
 
;-------------------------------------------------------------------------------
; Some helper functions...
Func _WinAPI_PKEYFromString($sPKEY, $pID = Default)
Local $tPKEY = DllStructCreate("byte GUID[16]; dword PID;")
DllCall("propsys.dll", "long", "PSPropertyKeyFromString", "wstr", $sPKEY, "ptr", DllStructGetPtr($tPKEY))
If @error Then ; alternaive for unsupported systems
  Local $tGUID = _WinAPI_GUIDFromString($sPKEY)
  If Not @error Then
   DllStructSetData($tPKEY, "GUID", DllStructGetData(DllStructCreate("byte Data[16]", DllStructGetPtr($tGUID)), 1))
  EndIf
  DllStructSetData($tPKEY, "PID", Number(StringRegExpReplace($sPKEY, ".*?}", "")))
EndIf
If $pID <> Default Then DllStructSetData($tPKEY, "PID", $pID)
Return $tPKEY
EndFunc   ;==>_WinAPI_PKEYFromString
 
Func _WinAPI_PtrStringLenW($pString)
Local $aCall = DllCall("kernel32.dll", "dword", "lstrlenW", "ptr", $pString)
If @error Then Return SetError(1, 0, 0)
Return $aCall[0]
EndFunc   ;==>_WinAPI_PtrStringLenW
 
Func _WinAPI_CoTaskMemFree($pMem)
DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pMem)
If @error Then Return SetError(1, 0, False)
Return True
EndFunc   ;==>_WinAPI_CoTaskMemFree
;-------------------------------------------------------------------------------

What code does is creates an invalid link on your desktop (don't forget to delete it afterwards). Btw, error handler is initialized, that's why I'm not checking for errors.

If you go line by line you will see that we have certain doubts. First one is adding new AutoIt-COM data type "clsid". This is standard COM VARIANT, but wasn't known to AutoIt before. From the script's side it would be a string. Adding it would reduce the script code by getting rid of the _WinAPI_GUIDFromString() structs and that function that's opposite of that .

Next thing to see is strings in general. Byref (actually [out]) strings you can collect directly using e.g. "wstr*" type. But this will leave you with memory leak because AutoIt doesn't know what method is used for allocation and that's why it can't free returned memory. That's why it's better to use "ptr*".

"str" and "wstr" types are ok to use with the current difference to DllCall() usage of this types. Currently these types are not treated as byref. This should be changed unless the end of the world would happen in the mean time or the smart reason against appears. If you have any, do say.

[out] parameters are treated the same way as [in, out]. This is why you should set [out] params to 0 before the call. This can be done internally, but would require adding new "magic" character identifying these types, complicating the scheme additionally. It's common sense thing, but will be added if necessary.

Structures as types of parameters will be added eventually to eliminate the differences between x64 and x86 scripts that the lack of them creates (much like with DllCall).

Also, WinAPI.au3 probably misses some functions. :graduated:

♡♡♡

.

eMyvnE

Link to post
Share on other sites

Thanks trancexx for your work in adding the ObjCreateInterface feature to the language, as well as the other developers for making it a reality. So far, all of my Object tests are going well.

Here's my experiments with native callback types of objects. Obviously the floating point bugs are still an issue here with callbacks, but otherwise its working nicely:

; ==========================================================================================================================
; Func _ObjCreateObject($iNumMethods,$aMethodPtrs,$tagInterface)
;
; Creates a virtual object based on function pointers and an interface description.
;   A virtual object consists of a VTable pointer, a count of the # of functions, and the VTable itself,
;   and of course the internal AutoIt representation of the methods/calltypes
;
; $iNumMethods = # of functions in $aMethodPtrs
; $aMethodPtrs = a 1-Dimensional array of either DLLCallback handles, or function pointers
; $tagInterface = interface description in the format outlined in AutoIt help.
;
; Returns:
;   Success: 2-element array. [0] = object, [1] = DLLStruct (necessary to keep this until object destruction)
;   Failure: 0 and @error set
;
; Author: Ascend4nt
; ==========================================================================================================================
 
Func _ObjCreateObject($iNumMethods,$aMethodPtrs,$tagInterface)
 
    If $iNumMethods<1 Or Not IsString($tagInterface) Or $tagInterface='' Then Return SetError(1,0,0)
    If Not IsArray($aMethodPtrs) Or UBound($aMethodPtrs)<$iNumMethods Then Return SetError(1,0,0)
 
    Local $vPtr,$sObjVTable='ptr['&$iNumMethods&'];', $stObj=DllStructCreate('ptr;ulong_ptr;'&$sObjVTable)
 
    ; Error in DLLStruct creation?  Probably too high a # of methods
    If @error Then Return SetError(-1,@error,0)
 
    ; Set VTable pointer
    DllStructSetData($stObj,1,DllStructGetPtr($stObj,3))
    ; Number-of-functions count (future expansion)
    DllStructSetData($stObj,2,$iNumMethods)
 
    ; Set up VTable with function pointers
    For $i=1 To $iNumMethods
        $vPtr=$aMethodPtrs[$i-1]
        If Not IsPtr($vPtr) Then
            $vPtr=DllCallbackGetPtr($vPtr)
            If $vPtr=0 Then Return SetError(1,$i-1,0)
        EndIf
        DllStructSetData($stObj,3,$vPtr,$i)
    Next
 
    Local $aRet[2]=[0,$stObj]
    $aRet[0]=ObjCreateInterface(DllStructGetPtr($stObj),"",$tagInterface,False) ; False -> not an IUnknown-derived object
    If @error Then Return SetError(@error,0,0)
    Return $aRet
EndFunc
 
 
; ==========================================================================================================================
 
; ==========================================================================================================================
 
Func _MyMessageBox($pThis,$hWnd,$sTitle,$sCaption,$iFlags)
    Return MsgBox($iFlags,$sTitle,$sCaption,0,$hWnd)
EndFunc
Func _MyMessageBeep($pThis,$iBeep)
    Local $aRet=DllCall('user32.dll','bool','MessageBeep','uint',$iBeep)
    If @error Then Return 0
    Return $aRet[0]
EndFunc
Func _MyBeep($pThis,$iFreq,$iDur)
    Return Beep($iFreq,$iDur)
EndFunc
Func _MyFloatTest($pThis,$fFloat,$iInt,$fDouble)
    ConsoleWrite("MyFloatTest function called. Vars: Float:"&$fFloat&", Int:"&$iInt&", Double:"&$fDouble&@CRLF)
    Return 7865.4
EndFunc
Func _MyFloatTest2($pThis,$fDouble,$iInt,$iInt2,$fFloat)
    ConsoleWrite("MyFloatTest2 function called. Vars: Double:"&$fDouble&", Int:"&$iInt&", Int2:"&$iInt2&", Float:"&$fFloat&@CRLF)
    Return 786.54
EndFunc
 
; ==========================================================================================================================
 
; ==========================================================================================================================
 
Local $iMyFuncs=5
Local $aMyFuncs[$iMyFuncs]= [ _
    DllCallbackRegister('_MyMessageBox','int','ptr;hwnd;wstr;wstr;uint'), _
    DllCallbackRegister('_MyMessageBeep','bool','ptr;uint'), _
    DllCallbackRegister('_MyBeep','bool','ptr;dword;dword'), _
    DllCallbackRegister('_MyFloatTest','float','ptr;float;int;double'), _
    DllCallbackRegister('_MyFloatTest2','double','ptr;double;int;int;float') _
]
 
Local $tagMyFuncsInterface= '' & _
    'MessageBox int(hwnd;wstr;wstr;uint);' & _
    'MessageBeep bool(uint);' & _
    'Beep bool(dword;dword);' & _
    'FloatTest float(float;int;double);' & _
    'FloatTest2 double(double;int;int;float);'
 
$aInterface=_ObjCreateObject($iMyFuncs,$aMyFuncs,$tagMyFuncsInterface)
If @error Then Exit
 
$oMyObj=$aInterface[0]  ; Make it easier to use (addref might be called for IUnknown-derived objects)
 
ConsoleWrite("..-> Return from FloatTest with Obj Method: "&$oMyObj.FloatTest(1234,10,4321)&@CRLF)
 
$aRet=DLLCallAddress('float',DllCallbackGetPtr($aMyFuncs[$iMyFuncs-2]),'ptr',0,'float',1234,'int',10,'double',4321)
ConsoleWrite("()-> Return from FloatTest with DLLCallAddress: "&$aRet[0]&@CRLF)
 
ConsoleWrite("..-> Return from FloatTest2 with Obj Method: "&$oMyObj.FloatTest2(1234,10,20,4321)&@CRLF)
$aRet=DLLCallAddress('double',DllCallbackGetPtr($aMyFuncs[$iMyFuncs-1]),'ptr',0,'double',1234,'int',10,'int',20,'float',4321)
ConsoleWrite("()-> Return from FloatTest2 with DLLCallAddress: "&$aRet[0]&@CRLF)
 
$oMyObj.MessageBeep(0)
 
Sleep(250)
 
$oMyObj.Beep(10000,250)
 
$aInterface[0].MessageBox(0,"This is some MessageBox Text","This is a MessageBox Caption",1)
 
For $i=0 To $iMyFuncs-1
    DllCallbackFree($aMyFuncs[$i])
Next
Edited by Ascend4nt
Link to post
Share on other sites

Anybody notice a HUGE performance difference with COM in the Beta version (versus Production)? The below code runs an average of 5x slower on 3.3.7.18 than on 3.3.6.1! (tested in both 32 and 64-bit mode).:

; ==========================================================================================================================
; Func _ObjectSHFolderViewFromWin($hWnd)
;
; Returns an 'ShellFolderView' Object for the given Window handle
;
; Author: Ascend4nt, based on code by KaFu, klaus.s
; ==========================================================================================================================
 
Func _ObjectSHFolderViewFromWin($hWnd)
    If Not IsHWnd($hWnd) Then Return SetError(1,0,0)
    Local $oShell,$oShellWindows,$oIEObject,$oSHFolderView
 
    ; Shell Object
    $oShell=ObjCreate("Shell.Application")
    If Not IsObj($oShell) Then Return SetError(2,0,0)
 
;   Get a 'ShellWindows Collection' object
    $oShellWindows = $oShell.Windows()
    If Not IsObj($oShellWindows) Then Return SetError(3,0,0)
 
;   Iterate through the collection - each of type 'InternetExplorer' Object
 
    For $oIEObject In $oShellWindows
        If $oIEObject.HWND = $hWnd Then
            ; InternetExplorer->Document = ShellFolderView object
            $oSHFolderView=$oIEObject.Document
            If IsObj($oSHFolderView) Then Return $oSHFolderView
            Return SetError(4,0,0)
        EndIf
    Next
 
    Return SetError(-1,0,0)
EndFunc
 
; ==========================================================================================================================
; Func _ExplorerWinGetAllItems($hWnd)
;
;
; Author: Ascend4nt, based on code by klaus.s, KaFu
; ==========================================================================================================================
 
Func _ExplorerWinGetAllItems($hWnd)
    If Not IsHWnd($hWnd) Then Return SetError(1,0,'')
    Local $oSHFolderView,$oFolderItem,$oFolderItems
    Local $iTotal,$iCounter=2,$aItems[2] = [0, ""]
 
    $oSHFolderView=_ObjectSHFolderViewFromWin($hWnd)
    If @error Then Return SetError(@error,0,'')
 
;   Folder->FolderItems Collection
    $oFolderItems = $oSHFolderView.Folder.Items
    $iTotal = $oFolderItems.Count
 
    Dim $aItems[$iTotal+2]  ; 2 extra -> 1 for count [0], 1 for Folder path [1]
 
    $aItems[0]=$iTotal
;   ShellFolderView->Folder->Self as 'FolderItem'->Path
    $aItems[1]=$oSHFolderView.Folder.Self.Path
 
    For $oFolderItem In $oFolderItems
        $aItems[$iCounter] = $oFolderItem.Path
        $iCounter += 1
    Next
 
    Return SetExtended($iCounter-2,$aItems)
EndFunc   ;==>_ExplorerWinGetAllItems
 
 
; ==========================================================================================================================
; ==========================================================================================================================
 
#include <Array.au3>
 
ConsoleWrite("AutoIt Version:"&@AutoItVersion&@CRLF)
 
$aWinList=WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]")
 
For $i = 1 To $aWinList[0][0]
    $iTimer=TimerInit()
    $aSelection = _ExplorerWinGetAllItems($aWinList[$i][1])
    ConsoleWrite("Time:"&TimerDiff($iTimer)&" ms"&@CRLF)
    _ArrayDisplay($aSelection, "Explorer Instance #" & $i & " / " & $aWinList[$i][0])
Next

*edit: Please comment if you have the same experience so we can decide on generating a ticket, otherwise the issue might not get fixed before the next release!

Edited by Ascend4nt
Link to post
Share on other sites

Please comment

Here are my results

AutoIt Version:3.3.6.1

Time:30.4280692924094 ms

Time:34.5973567019106 ms

Time:9.94803535952854 ms

Time:22.9410991186784 ms

Time:25.7621835042199 ms

Time:13.7772863028493 ms

Time:72.2186760843189 ms

Time:11.9909571205717 ms

Time:9.60461193850749 ms

Time:20.9733173557686 ms

Time:12.8345008733217 ms

AutoIt Version:3.3.7.18

Time:81.8984910201197 ms

Time:149.899415341129 ms

Time:42.2884411541179 ms

Time:102.795429394275 ms

Time:94.2954357275236 ms

Time:65.2879344942067 ms

Time:258.054651271316 ms

Time:61.7395428060959 ms

Time:44.8276432980894 ms

Time:74.9654454607272 ms

Time:50.3332838895481 ms

Edited by AZJIO
Link to post
Share on other sites

Hello. I'm new here and I have got a question. I think its very easy for YOU, but i dont know the right script commands. (I cannot open a new topic so I ask here, I hope its okay.)

<Rest of the post removed because the user doesn't deserve help>

Edited by Valik
User is an idiot.
Link to post
Share on other sites

Hello. I'm new here and I have got a question.

Then open a topic in General Help and Support for your specific question.

If you continue hijacking other topics with off-topic questions, you will not last long around here.

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

Hello. I'm new here and I have got a question. I think its very easy for YOU, but i dont know the right script commands. (I cannot open a new topic so I ask here, I hope its okay.)

<Rest of the post removed because the user doesn't deserve help>

It is not okay. In fact it's the exact opposite of okay. Also, I'm not so sure a scripting language is right for you when basic forum usage eludes you.
Link to post
Share on other sites

Then open a topic in General Help and Support for your specific question.

Thank you, this is the only meaningful contribution to my question. I opened a new Topic in General Help and Support. Thanks.

If you continue hijacking other topics with off-topic questions, you will not last long around here.

:graduated:

I cannot start new topics except here or in General Help and Support, because I'm a new member of your forum. And I thought "General Help" refers only to the programme if it is not running on a computer for example. I had not the intention to spam :) Sorry!!

User is an idiot.

??

-is not that a bit excessive?

It is not okay. In fact it's the exact opposite of okay. Also, I'm not so sure a scripting language is right for you when basic forum usage eludes you.

Cool, new people are really not welcome here or what did i wrong? The Reply before teached me to move my question. That's okay. But not saying "in fact it's the exact opposite of okay."

I'm not exactly clear what means "when basic forum usage eludes you." But I was never deprived of a privilege. I'm new, the privilege are not given to me yet and I dont know to change.

So all in all sorry that I missed the topic. That will no longer occur, kay ;) ( and a second time, I apologize for grammar mistakes :b )

Edited by KillKill
Link to post
Share on other sites

-is not that a bit excessive?

No, it's not excessive. You've now posted off-topic twice in this thread AND you PMed me to apologize. You are off to a horrible start on this forum. The best thing you can do is shut the fuck up and learn how things work around here. Stop apologizing. Stop posting in topics about unrelated non-sense. You're already a hassle to deal with and I generally make hassles go away.
Link to post
Share on other sites

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.7.19 (15th October, 2011 (Beta)

AutoIt:

- Added: "clsid" InterfaceDispatch data type.

- Changed: "str" and "wstr" InterfaceDispatch data types treated as true byref types.

- Changed: COM Error handler event has precedence in execution over events fired by other objects.

- Changed: COM Error handler passes error object as first parameter to user defined error function.

- Changed: ObjEvent() has new example and more detailed explanation.

- Changed: COM Error handler properties are read-only.

- Removed: COM Error object no longer exposes methods Raise() and Clear().

The following changes are script breaking changes:

AutoIt:

  • ObjName() has had a number of bug fixes and changes that may affect data returned. Built-in UDFs have been changed to accomodate this but custom scripts may need to be edited.
  • ObjEvent() AutoIt.Error objects no longer have Raise() or Clear() methods and the properties are read-only.

ObjCreateInterface() now has documentation. Test it out! Report any bugs, questions, et cetera so we can get it finalized.

Report issues here.

Download here.

Edited by Valik
Link to post
Share on other sites

Gee, how do we report issues with the issue reporting system? lol. I've tried to create a new ticket and I get this message:

Submission rejected as potential spam (Akismet says content is spam)

The content was this:

So the beta COM interface has slowed down tremendously. I know there's been major changes, but this is a huge performance difference. I'm seeing between 4-5x slower speed on the code below on beta 3.3.7.18 and 3.3.7.19, versus the production 3.3.6.1..

(Use it with at least one folder with a few hundred or so items, thats where the performance difference is most noticeable):

...with my code attached from response above. Well, I gave it a shot.

*update: trancexx was kind enough to put this in as ticket #2037

Edited by Ascend4nt
Link to post
Share on other sites

Tried, no luck. Also tried clicking 'login' in the trac system for the heck of it, but that only gave me a 'Trac Error - Authentication information not available'. Thanks in advance when you add it.

Link to post
Share on other sites

New AutoIt brought few improvements to ObjCreateInterface function. To show what they are I'm gonna post adjusted code from the beta was out.

#include <WinApi.au3>
;===============================================================================
#interface "IPersist"
Global Const $sIID_IPersist = "{0000010c-0000-0000-C000-000000000046}"
; Definition
Global $tagIPersist = "GetClassID hresult(ptr*);"
;===============================================================================
;===============================================================================
#interface "IPersistFile"
Global Const $sIID_IPersistFile = "{0000010b-0000-0000-C000-000000000046}"
; Definition
Global $tagIPersistFile = $tagIPersist & _
  "IsDirty hresult();" & _
  "Load hresult(wstr;dword);" & _
  "Save hresult(wstr;bool);" & _
  "SaveCompleted hresult(wstr);" & _
  "GetCurFile hresult(ptr*);"
;===============================================================================
;===============================================================================
#interface "IShellLinkW"
Global Const $sCLSID_ShellLink = "{00021401-0000-0000-C000-000000000046}"
Global Const $sIID_IShellLinkW = "{000214F9-0000-0000-C000-000000000046}"
; Definition
Global Const $tagIShellLinkW = "GetPath hresult(ptr;int;ptr;dword);" & _
  "GetIDList hresult(ptr*);" & _
  "SetIDList hresult(ptr);" & _
  "GetDescription hresult(wstr;int);" & _
  "SetDescription hresult(wstr);" & _
  "GetWorkingDirectory hresult(wstr;int);" & _
  "SetWorkingDirectory hresult(wstr);" & _
  "GetArguments hresult(ptr;int);" & _
  "SetArguments hresult(wstr);" & _
  "GetHotkey hresult(word*);" & _
  "SetHotkey hresult(word);" & _
  "GetShowCmd hresult(int*);" & _
  "SetShowCmd hresult(int);" & _
  "GetIconLocation hresult(ptr;int;ptr*);" & _
  "SetIconLocation hresult(wstr;int);" & _
  "SetRelativePath hresult(wstr);" & _
  "Resolve hresult(hwnd;dword);" & _
  "SetPath hresult(wstr);"
;===============================================================================
;===============================================================================
#interface "IPropertyStore"
Global Const $sIID_IPropertyStore = "{886d8EEB-8CF2-4446-8D02-CDBA1DBDCF99}"
; Definition
Global Const $tagIPropertyStore = "GetCount hresult(dword*);" & _
  "GetAt hresult(dword;ptr*);" & _
  "GetValue hresult(ptr;variant*);" & _
  "SetValue hresult(ptr;variant*);" & _
  "Commit hresult();"
;===============================================================================
Global Const $S_OK = 0
Global Const $sPKEY_Title = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 2"
;-------------------------------------------------------------------------------
; Error monitoring
Global $oErrorObject = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc($oError)
    ConsoleWrite("COM Error, ScriptLine(" & $oError.scriptline & ") : Number 0x" & Hex($oError.number, 8) & " - " & $oError.windescription & @CRLF)
EndFunc   ;==>_ErrFunc
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; IShellLink interface object
Local $oShellLink = ObjCreateInterface($sCLSID_ShellLink, $sIID_IShellLinkW, $tagIShellLinkW)
; Costumize
$oShellLink.SetPath(@DesktopDir & "\ImaginaryFileOrWhatever.ext") ; just to test
$oShellLink.SetArguments('"' & @ScriptName & '"') ; something
$oShellLink.SetIconLocation("shell32.dll", -10) ; for example
$oShellLink.SetWorkingDirectory(@ScriptDir) ; ...
$oShellLink.SetDescription("Bzzzz...") ; ...
; Read set description for practice
Local $sDesc
$oShellLink.GetDescription($sDesc, 65535)
; Print it
ConsoleWrite("--->Description = " & $sDesc & @CRLF)
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; QueryInterface for IPersistFile interface object
Local $pPersistFile
$oShellLink.QueryInterface($sIID_IPersistFile, $pPersistFile)
; Make the object with IPersistFile interface
Local $oPersistFile = ObjCreateInterface($pPersistFile, $sIID_IPersistFile, $tagIPersistFile)
; Use it to save ShellLink item to disk
$oPersistFile.Save(@DesktopDir & "\zz.lnk", True)
; Check what's current file (for practice)
Local $pCurFile
$oPersistFile.GetCurFile($pCurFile)
Local $sCurFile = DllStructGetData(DllStructCreate("wchar Name[" & _WinAPI_PtrStringLenW($pCurFile) & "]", $pCurFile), "Name")
_WinAPI_CoTaskMemFree($pCurFile) ; documentation for GetCurFile method is very specific about releasing
; Print the result of the query
ConsoleWrite("> CurFile = " & $sCurFile & @CRLF)
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; QueryInterface for IPropertyStore interface object
Local $pPropertyStore
$oShellLink.QueryInterface($sIID_IPropertyStore, $pPropertyStore)
; Make the object with IPropertyStore interface
Local $oPropertyStore = ObjCreateInterface($pPropertyStore, $sIID_IPropertyStore, $tagIPropertyStore)
; Title
Local $tPKEY_Title = _WinAPI_PKEYFromString($sPKEY_Title)
; Set it
$oPropertyStore.SetValue(DllStructGetPtr($tPKEY_Title), "Testing title")
; Read set
Local $vVal = 0 ; GetValue method will use it as [out].
$oPropertyStore.GetValue(DllStructGetPtr($tPKEY_Title), $vVal)
; Print
ConsoleWrite("--->Title = " & $vVal & @CRLF)
;-------------------------------------------------------------------------------
 
;-------------------------------------------------------------------------------
; Some helper functions...
Func _WinAPI_PKEYFromString($sPKEY, $pID = Default)
    Local $tPKEY = DllStructCreate("byte GUID[16]; dword PID;")
    DllCall("propsys.dll", "long", "PSPropertyKeyFromString", "wstr", $sPKEY, "ptr", DllStructGetPtr($tPKEY))
    If @error Then ; alternaive for unsupported systems
      Local $tGUID = _WinAPI_GUIDFromString($sPKEY)
      If Not @error Then
       DllStructSetData($tPKEY, "GUID", DllStructGetData(DllStructCreate("byte Data[16]", DllStructGetPtr($tGUID)), 1))
      EndIf
      DllStructSetData($tPKEY, "PID", Number(StringRegExpReplace($sPKEY, ".*?}", "")))
    EndIf
    If $pID <> Default Then DllStructSetData($tPKEY, "PID", $pID)
    Return $tPKEY
EndFunc   ;==>_WinAPI_PKEYFromString
Func _WinAPI_PtrStringLenW($pString)
    Local $aCall = DllCall("kernel32.dll", "dword", "lstrlenW", "ptr", $pString)
    If @error Then Return SetError(1, 0, 0)
    Return $aCall[0]
EndFunc   ;==>_WinAPI_PtrStringLenW
Func _WinAPI_CoTaskMemFree($pMem)
    DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pMem)
    If @error Then Return SetError(1, 0, False)
    Return True
EndFunc   ;==>_WinAPI_CoTaskMemFree
;-------------------------------------------------------------------------------

Comparing it you will see that "clsid" data type is fully functional. Remember that this type is (just like "str" and "wstr") passed as pointer even though you have set its value to be string. All necessary conversation are done internally.

I said that you set its value to string but for your convenience AutoIt will accept pointer to CLSID dllstruct and even the sruct iself (make sure it's alive during the call).

Also, new thing is that string types are always copied back to your variables after the call, regardless if you pass them byref or not (they are pointers). Posted code shows that.

Edited by trancexx
eng

♡♡♡

.

eMyvnE

Link to post
Share on other sites

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.7.20 (22nd October, 2011 (Beta)

AutoIt:

- Added: "struct" as DllCall and InterfaceDispatch data type.

- Fixed #1519, #1694: Int() and Number() returning wrong.

- Changed: Dec() and Hex() work with 64bit integers.

- Removed: Int() and Hex() no longer set @error.

The following changes are script breaking changes:

AutoIt:

  • ObjName() has had a number of bug fixes and changes that may affect data returned. Built-in UDFs have been changed to accomodate this but custom scripts may need to be edited.
  • ObjEvent() AutoIt.Error objects no longer have Raise() or Clear() methods and the properties are read-only.
  • Int() and Hex() no longer set @error.

ObjCreateInterface() now has documentation. Test it out! Report any bugs, questions, et cetera so we can get it finalized.

Report issues here.

Download here.

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...