Leaderboard
Popular Content
Showing content with the highest reputation on 08/09/2022 in all areas
-
Create PDF from your application
felix12123 reacted to taietel for a topic
If you look to output PDF's from your application (generate reports, graphics, tables etc), this UDF can be very useful. In the zip file are examples, images for testing and the UDF. Enjoy! I have removed some of the previous versions due to the lack of space, but they are still available on request. [uPDATED June 22] v.1.0.1 Added more page formats, two more fonts, example table ... [uPDATED July 30] v1.0.2 Solved issues with Adobe Reader. StuffByDennis added two more functions (Thanks Dennis). [uPDATED August 10] v1.0.3 Rewrote entirely _LoadResImage function - optimize for speed/size of the pdf. Fixed the Example_Image2PDF Thanks to xavierh for finding a missing space in the _LoadFontTT function (even it looks insignificant, that solved an issue with text justification when using Adobe Reader, not Foxit Reader) Total downloads old versions: 2044 + 21 Version 1.0.3: MPDFv103.zip1 point -
WebDriver UDF - Help & Support (III)
seadoggie01 reacted to Jos for a topic
*click* to avoid posts of people that don't read, which I know hardly happens, but still.......1 point -
Yep ... I now understand what is happening.... any "current file" word without a $ prefix that matches will be shown in the $ dropwdown list. Will have a look. Will be fixed in the next version, so it will only show Variables names when the typed word is prefixed with a $.1 point
-
email "AutoItPortable_for_JOS__testing_LUA.zip - part 3" sent.1 point
-
<snip> Note for moderators, LGHUB isn't a game. It's a program for controlling mouse, keyboard and stuff. Stop asking like "why are you trying to read/write process memory" everytime. It's an udf created by popular autoit users. Nothing illegal as you think. Read & write doesn't mean game hacking and/or automating.1 point
-
Using an example from another thread, I found a solution.1 point
-
Yes, eliminating the need for an HDD, no RamD either. And yes inf files to be specific. I can list the contents and filter out inf files using the dll just fine, i will post the current funcs shortly. Edit: added 7z.dll modified example from an old thread. #include <WinApi.au3> #Include <7zConst.au3> #Include <Array.au3> #Include-Once ;Global Const $sFilePath= ;Implement MemoryMode Global $_h7z_Dll Global $_o7z_IInArchive,$_o7z_IStream,$_t7z_IInStream,$_o7z_IInStream _7zInit() _7zOpen(@ScriptDir&"\Test.7z") ;_7zSearch(".inf") ;_7zGetPaths() _7zExtract("matchver\FORCED\5x86\D-Link\DGE-660\DGE660T.INF") _7zClose() ;_7zUnInit() Func _7zGetPaths() Local $aList=_7zListToArray() Local $sResults Local $aResults[0][2] Local $iBounds=UBound($aList,1)-1 For $iIndex=0 To $iBounds $bTest=$aList[$iIndex][1]="True" If $bTest Then $sResults&=$iIndex&"|"&$aList[$iIndex][0]&@CRLF EndIf Next If StringRight($sResults,2)=@CRLF Then $sResults=StringTrimRight($sResults,2) __ArrayAdd($aResults,$sResults) Return $aResults EndFunc ;"Extract hresult(uint;uint;int;ptr) ; STDMETHOD(Extract)(const UInt32* indices,UInt32 numItems,Int32 testMode,IArchiveExtractCallback *extractCallback) x; \ Func _7zExtract($vFilePath) Local $bIsPath,$bIsMulti If IsArray($vFilePath) Then ;HandelArray Return 1 EndIf If IsString($vFilePath) Then Local $aList=_7zListToArray() $_i7z_FileIndex=_ArraySearch($aList,$vFilePath) Local $hCallback ConsoleWrite($_o7z_IInArchive.Extract($_i7z_FileIndex,1,False,$hCallback)&@CRLF) ConsoleWrite(VarGetType($hCallback)&"|"&$hCallback&"|"&Binary($hCallback)&@CRLF) EndIf EndFunc Func _7zFileExtractMem() ;$_o7z_IStream= _WinAPI_SHCreateStreamOnFile($sFilePath) EndFunc Func _7zSearch($sQuery) Local $aList=_7zListToArray() Local $sResults Local $aResults[0][2] $aSearch=_ArrayFindAll($aList,$sQuery,0,0,0,1,0) $iBounds=UBound($aSearch,1)-1 For $iIndex=1 To $iBounds If $iIndex=$iBounds Then $sResults&=$aSearch[$iIndex]&"|"&$aList[$aSearch[$iIndex]][0] Else $sResults&=$aSearch[$iIndex]&"|"&$aList[$aSearch[$iIndex]][0]&@CRLF EndIf Next __ArrayAdd($aResults,$sResults) Return $aResults EndFunc Func _7zInit() If $_h7z_Dll="" Then $_h7z_Dll=DllOpen(@ScriptDir&"\7z.dll") If $_h7z_Dll=-1 Then Return 1 EndIf EndIf ; 1. Create IInArchive object: $_o7z_IInArchive= _7z_CreateObject($_s7z_CLSID_Format7z,$_s7z_IID_IInArchive,$_tag7z_IInArchive) If Not IsObj($_o7z_IInArchive) Then $_o7z_IInArchive="" EndIf EndFunc Func _7zOpen($sFilePath) ; 2. Create IStream on file: $_o7z_IStream= _WinAPI_SHCreateStreamOnFile($sFilePath) If Not IsObj($_o7z_IInArchive) Then Exit 2 ; 2a. Create IInStream on file (wrapping IStream inside methods): $_t7z_IInStream="" $_o7z_IInStream=ObjectFromTag("IInStream_",$_tag7z_IInStream,$_t7z_IInStream,Default,$_s7z_IID_IInStream) If Not IsObj($_o7z_IInArchive) Then Exit 6 ; 3. Load the archive: $_o7z_IInArchive.Open($_o7z_IInStream,1024,0) ;Return $_o7z_IInStream EndFunc Func _7zClose() $_o7z_IInArchive.Close() EndFunc Func _7zGetItemCount() ; 4. Do something with it. For example I will check how many compressed items are inside: Local $iCount $_o7z_IInArchive.GetNumberOfItems($iCount) Return $iCount EndFunc Func _7zGetPropertyCount() Local $iCount $_o7z_IInArchive.GetNumberOfArchiveProperties($iCount) Return $iCount EndFunc Func _7zListToArray() $iMaxCount=_7zGetItemCount() Local $iTempNumOfProperties Local $vResult Local $vResults="" Local $aResults[0][4] For $b=0 To $iMaxCount-1 $vResult="" $iMaxProps=UBound($_a7z_PropID,1)-1 $vResult="" $_o7z_IInArchive.GetProperty($b,3,$vResult) $vResults&=$vResult&"|" $vResult="" $_o7z_IInArchive.GetProperty($b,6,$vResult) $vResults&=$vResult&"|" $vResult="" $_o7z_IInArchive.GetProperty($b,7,$vResult) $vResults&=$vResult&"|" $vResult="" $_o7z_IInArchive.GetProperty($b,8,$vResult) If $b=$iMaxCount-1 Then $vResults&=$vResult Else $vResults&=$vResult&@CRLF EndIf ;onsoleWrite($vResult&@CRLF) ;_ArrayDisplay($aResults) Next __ArrayAdd($aResults,$vResults) Return $aResults EndFunc ;<<<<<< The End >>>>>>>; ;======================; Func __ArrayAdd(ByRef $avArray,$vValue,$iStart=0,$sDelim_Item="|",$sDelim_Row=@CRLF,$hDataType=0) If $iStart=Default Then $iStart=0 If $sDelim_Item=Default Then $sDelim_Item="|" If $sDelim_Row=Default Then $sDelim_Row=@CRLF If $hDataType=Default Then $hDataType=0 If Not IsArray($avArray) Then Return SetError(1,0,-1) Local $iDim_1=UBound($avArray,$UBOUND_ROWS) Switch UBound($avArray,$UBOUND_DIMENSIONS) Case 1 If IsArray($vValue) Then If UBound($vValue,$UBOUND_DIMENSIONS)<>1 Then Return SetError(5,0,-1) $hDataType=0 Else Local $aTmp=StringSplit($vValue,$sDelim_Item,$STR_NOCOUNT+$STR_ENTIRESPLIT) If UBound($aTmp,$UBOUND_ROWS)=1 Then $aTmp[0]=$vValue $hDataType=0 EndIf $vValue=$aTmp EndIf Local $iAdd=UBound($vValue,$UBOUND_ROWS) ReDim $avArray[$iDim_1+$iAdd] For $i=0 To $iAdd-1 If IsFunc($hDataType) Then $avArray[$iDim_1+$i]=$hDataType($vValue[$i]) Else $avArray[$iDim_1+$i]=$vValue[$i] EndIf Next Return $iDim_1+$iAdd-1 Case 2 Local $iDim_2=UBound($avArray,$UBOUND_COLUMNS) If $iStart<0 Or $iStart>$iDim_2-1 Then Return SetError(4,0,-1) Local $iValDim_1,$iValDim_2 If IsArray($vValue) Then If UBound($vValue,$UBOUND_DIMENSIONS)<>2 Then Return SetError(5,0,-1) $iValDim_1=UBound($vValue,$UBOUND_ROWS) $iValDim_2=UBound($vValue,$UBOUND_COLUMNS) $hDataType=0 Else ; Convert string to 2D array Local $aSplit_1=StringSplit($vValue,$sDelim_Row,$STR_NOCOUNT+$STR_ENTIRESPLIT) $iValDim_1=UBound($aSplit_1,$UBOUND_ROWS) StringReplace($aSplit_1[0],$sDelim_Item,"") $iValDim_2=@extended+1 Local $aTmp[$iValDim_1][$iValDim_2],$aSplit_2 For $i=0 To $iValDim_1-1 $aSplit_2=StringSplit($aSplit_1[$i],$sDelim_Item,$STR_NOCOUNT+$STR_ENTIRESPLIT) ;_ArrayDisplay($aSplit_2) If UBound($aSplit_2,1)=1 Then ContinueLoop For $j=0 To $iValDim_2-1 $aTmp[$i][$j]=$aSplit_2[$j] Next Next $vValue=$aTmp EndIf ; Check if too many columns to fit If UBound($vValue,$UBOUND_COLUMNS)+$iStart>UBound($avArray,$UBOUND_COLUMNS) Then Return SetError(3,0,-1) ReDim $avArray[$iDim_1+$iValDim_1][$iDim_2] For $iWriteTo_Index=0 To $iValDim_1-1 For $j=0 To $iDim_2-1 If $j<$iStart Then $avArray[$iWriteTo_Index+$iDim_1][$j]="" ElseIf $j-$iStart>$iValDim_2-1 Then $avArray[$iWriteTo_Index+$iDim_1][$j]="" Else If IsFunc($hDataType) Then $avArray[$iWriteTo_Index+$iDim_1][$j]=$hDataType($vValue[$iWriteTo_Index][$j-$iStart]) Else $avArray[$iWriteTo_Index+$iDim_1][$j]=$vValue[$iWriteTo_Index][$j-$iStart] EndIf EndIf Next Next Case Else Return SetError(2,0,-1) EndSwitch Return UBound($avArray,$UBOUND_ROWS)-1 EndFunc ;==>_ArrayAdd ; IInStream methods Func IInStream_QueryInterface($pSelf,$pRIID,$pObj) Local $tStruct=DllStructCreate("ptr",$pObj) ConsoleWrite("@IInStream_QueryInterface "& _WinAPI_StringFromGUID($pRIID)&@CRLF&@CRLF) Switch _WinAPI_StringFromGUID($pRIID) Case $_s7z_IID_IInStream Case Else ConsoleWrite("@IInStream_QueryInterface -> ERR"&@CRLF) Return $E_NOINTERFACE EndSwitch DllStructSetData($tStruct,1,$pSelf) Return $S_OK EndFunc Func IInStream_AddRef($pSelf) Return 1 EndFunc Func IInStream_Release($pSelf) Return 0 EndFunc Func IInStream_Read($pSelf,$pData,$iSize,$iProcessedSize) Return $_o7z_IStream.Read($pData,$iSize,$iProcessedSize) EndFunc Func IInStream_Seek($pSelf,$iOffset,$iSeekOrigin,$iNewPosition) Return $_o7z_IStream.Seek($iOffset,$iSeekOrigin,$iNewPosition) EndFunc Func _7z_CreateObject($sCLSID,$sIID,$sTag) Local $tCLSID= _WinAPI_GUIDFromString($sCLSID) Local $tIID= _WinAPI_GUIDFromString($sIID) Local $aCall=DllCall($_h7z_Dll,"long","CreateObject","struct*",$tCLSID,"struct*",$tIID,"ptr*",0) If @error Or $aCall[0] Then Return SetError(1,0,0) Return ObjCreateInterface($aCall[3],$sIID,$sTag) EndFunc Func _WinAPI_SHCreateStreamOnFile($sFile) Local $iGrfMode=0x00000002 Local $aCall=DllCall("shlwapi.dll","long","SHCreateStreamOnFileW","wstr",$sFile,"uint",$iGrfMode,"ptr*",0) If @error Or $aCall[0] Then Return SetError(1,0,0) Return ObjCreateInterface($aCall[3],$_s7z_IID_IStream,$_tag7z_IStream) EndFunc Func ObjectFromTag($sFunctionPrefix,$_tag7z_Interface, ByRef $tInterface,$bIsUnknown=Default,$sIID="{00000000-0000-0000-C000-000000000046}") ; last param is IID_IUnknown by default If $bIsUnknown=Default Then $bIsUnknown=True Local $sInterface=$_tag7z_Interface ; copy interface description Local $_tag7z_IUnknown="QueryInterface hresult(ptr;ptr*);"& _ "AddRef dword();"& _ "Release dword();" ; Adding IUnknown methods If $bIsUnknown Then $_tag7z_Interface=$_tag7z_IUnknown&$_tag7z_Interface ; Below line is really simple even though it looks super complex. It's just written weird to fit in one line,not to steal your attention Local $aMethods=StringSplit(StringTrimRight(StringReplace(StringRegExpReplace(StringRegExpReplace($_tag7z_Interface,"\w+\*","ptr"),"\h*(\w+)\h*(\w+\*?)\h*(\((.*?)\))\h*(;|;*\z)","$1\|$2;$4"&@LF),";"&@LF,@LF),1),@LF,3) Local $iUbound=UBound($aMethods) Local $sMethod,$aSplit,$sNamePart,$aTagPart,$sTagPart,$sRet,$sParams,$hCallback ; Allocation $tInterface=DllStructCreate("int RefCount;int Size;ptr Object;ptr Methods["&$iUbound&"];int_ptr Callbacks["&$iUbound&"];ulong_ptr Slots[16]") ; 16 pointer sized elements more to create space for possible private props If @error Then Return SetError(1,0,0) For $i=0 To $iUbound-1 $aSplit=StringSplit($aMethods[$i],"|",2) If UBound($aSplit)<>2 Then ReDim $aSplit[2] $sNamePart=$aSplit[0] ; Replace COM types by matching dllcallback types $sTagPart=StringReplace(StringReplace(StringReplace(StringReplace($aSplit[1],"object","idispatch"),"hresult","long"),"bstr","ptr"),"variant","ptr") $sMethod=$sFunctionPrefix&$sNamePart $aTagPart=StringSplit($sTagPart,";",2) $sRet=$aTagPart[0] $sParams=StringReplace($sTagPart,$sRet,"",1) $sParams="ptr"&$sParams $hCallback=DllCallbackRegister($sMethod,$sRet,$sParams) DllStructSetData($tInterface,"Methods",DllCallbackGetPtr($hCallback),$i+1) ; save callback pointer DllStructSetData($tInterface,"Callbacks",$hCallback,$i+1) ; save callback handle Next DllStructSetData($tInterface,"RefCount",1) ; initial ref count is 1 DllStructSetData($tInterface,"Size",$iUbound) ; number of interface methods DllStructSetData($tInterface,"Object",DllStructGetPtr($tInterface,"Methods")) ; Interface method pointers Return ObjCreateInterface(DllStructGetPtr($tInterface,"Object"),$sIID,$sInterface,$bIsUnknown) ; pointer that's wrapped into object EndFunc Func DeleteObjectFromTag(ByRef $tInterface) For $i=1 To DllStructGetData($tInterface,"Size") DllCallbackFree(DllStructGetData($tInterface,"Callbacks",$i)) Next $tInterface=0 EndFunc1 point
-
Don't you agree this is the wrong place to ask: Forum -> Is about AutoIt3 SubForum -> Is for AutoIt3 support questions *click* Jos0 points