[Lib] ObjDump / ObjLoad - Object Backup

Post your working scripts, libraries and tools for AHK v1.1 and older
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

16 Aug 2014, 14:25

Code: Select all

FileRead,file,*c %A_AhkPath%
BinRun(&file,"`nMsgBox `% A_Argv.a",{a:"Hello World!"})
BinRun_for_AutoHotkey_H_v1
BinRun_for_AutoHotkey_H_v2
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

16 Aug 2014, 22:47

Thanks.

Code: Select all

  static KeepExeInMem:=[]
	If pData
		{
		If InStr(pData,"AutoHotkey.exe") and  KeepExeInMem[pData] 
			pData:=KeepExeInMem.GetAddress(pData)
		else if (pData+0=""){
			If res := DllCall("FindResource","PTR",lib:=DllCall("GetModuleHandle","PTR",0,"PTR"),"Str",pData,"PTR",10,"PTR")
				{
				KeepExeInMem.SetCapacity(pData,sz :=DllCall("SizeofResource","PTR",lib,"PTR",res))
					,DllCall("RtlMoveMemory","PTR",pData:=KeepExeInMem.GetAddress(pData),"PTR"
					,DllCall("LockResource","PTR",hres:=DllCall("LoadResource","PTR",lib,"PTR",res,"PTR"),"PTR"),"PTR",sz)
					,DllCall("FreeResource","PTR",hres),BinRun_Uncompress(data)
				}
				else 
				{
				FileGetSize,sz,%pData%
				FileRead,Data,*c %pData%
				KeepExeInMem.SetCapacity(pData,sz)
					,DllCall("RtlMoveMemory","PTR",pData:=KeepExeInMem.GetAddress(pData),"PTR",&data,"PTR",sz)
				}
		}
		if !pData
			return false
	}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

28 Nov 2014, 05:50

I repaired it.
prevent an infinite loop.

ObjLoad(addr,sz:=""){
While % (addr and addr<end)
}
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

28 Nov 2014, 11:46

arcticir wrote:I repaired it.
prevent an infinite loop.

ObjLoad(addr,sz:=""){
While % (addr and addr<end)
}
This must not be used, there is a problem if addr gets empty, probably buffer is corrupt.
I have a modified version I am still testing which holds the size of buffer too.
Here is v2 update (experimental):
Dump object to variable/memory:
size := ObjDump(Object,Variable,DumpBuffer)
Load object from variable/memory:
Obj := ObjLoad(Address)
Dump object to file:
size := ObjDump(FilePath,Object,DumpBuffer)
Load object from file:
Obj := ObjLoad(FilePath)
Note wrote:New ObjLoad() function is not compatible to the old functions and cannot load a file dumped with old ObjDump function.
You can rename the old ObjLoad function to ObjLoad2 and run this with new ObjDump function:
ObjDump(ObjLoad2(File),File)
AutoHotkey v2
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

20 Aug 2015, 04:39

New versions for AutoHotkey v1 and v2:
- Updated to hold the size of dumped buffer, now it is even easier to use:
Dump object to variable/memory:
size := ObjDump(Object,Variable,DumpBuffer)
Load object from variable/memory:
Obj := ObjLoad(Address)
Dump object to file:
size := ObjDump(FilePath,Object,DumpBuffer)
Load object from file:
Obj := ObjLoad(FilePath)
Note wrote:New ObjLoad() function is not compatible to the old functions and cannot load a file dumped with old ObjDump function.
You can rename the old ObjLoad function to ObjLoad2 and run this with new ObjDump function:
ObjDump(ObjLoad2(File),File)
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

19 Feb 2016, 13:39

I wrote a new DynaRun() :D

Code: Select all

AhkRun("MsgBox `% A_Args.B","test",{A:"A",B:"B"})

AhkRun(Script,Title:="",Args:="",Tray:="",Path:=""){
	if (-1=p1:=DllCall("CreateNamedPipe","str",Pipe:="\\.\pipe\" (Title!=""?Title:"AHK" A_TickCount),"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
		or (-1=p2:=DllCall("CreateNamedPipe","str",Pipe,"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
	Return 0
	Run, % (Path?Path:A_AhkPath) " `"" Pipe "`"" (IsObject(Args)?"": " " Args),,UseErrorLevel HIDE,P
	If ErrorLevel
		return DllCall("CloseHandle","Ptr",p1),DllCall("CloseHandle","Ptr",p2),0
	DllCall("ConnectNamedPipe","Ptr",p1,"Ptr",0),DllCall("CloseHandle","Ptr",p1),DllCall("ConnectNamedPipe","Ptr",p2,"Ptr",0)
	Return DllCall("WriteFile","Ptr",p2,"Wstr"
			,Script:=chr(0xfeff) "Global h_Caller,h_CallerPid,h_CallerHwnd,h_ScriptDir`nAhkRun__Global(){`nstatic r:=AhkRun__Global()"
			. "`nh_Caller:=`"" A_ScriptName "`",h_CallerPid:=" ProcessExist() ",h_CallerHwnd:=`"" A_ScriptHwnd "`",h_ScriptDir:=`"" 
			. A_ScriptDir "`"`n" (Tray?"":"#NoTrayIcon") "`nSetWorkingDir," A_WorkingDir "`n"
			. (IsObject(Args)?((len:=ObjDump(Args,_Args)),(Hex:=BinToHex(&_Args,len))
			, "HexToBin(A_Args,`"" Hex "`"),A_Args:=ObjLoad((&A_Args))`n"):"") "`n}`n" Script
			,"UInt",StrLen(Script)*2+4,"uint*",0,"Ptr",0)
		?(DllCall("CloseHandle","Ptr",p2),P):0
}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

19 Feb 2016, 14:11

But when the obj is too large, there have been mistakes.

Image

Code: Select all

f:=[]
Loop 1000
{
f[A_Index]:= A_Index "sfasfdasfsdddddddddddddd"
}

AhkRun("MsgBox `% A_Args.2","test",f)
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

20 Feb 2016, 17:51

You would need to do it the same way as in BinRun, I have now implemented it in DynaRun too :)

Code: Select all

f:=[]
Loop 1000
{
f[A_Index]:= A_Index "sfasfdasfsdddddddddddddd"
}

AhkRun("MsgBox `% A_Args.1","test","Hello")

AhkRun(Script,Title:="",Args:="",Tray:="",Path:=""){
  static h2o:="B29C2D1CA2C24A57BC5E208EA09E162F(){`nPLACEHOLDERB29C2D1CA2C24A57BC5E208EA09E162FVarSetCapacity(dmp,sz:=StrLen(hex)//2,0)`nLoopParse,`%hex`%`nIf (`"`"!=h.=A_LoopField) && !Mod(A_Index,2)`nNumPut(`"0x`" h,&dmp,A_Index/2-1,`"UChar`"),h:=`"`"`nreturn ObjLoad(&dmp)`n}`n"
	if (-1=p1:=DllCall("CreateNamedPipe","str",Pipe:="\\.\pipe\" (Title!=""?Title:"AHK" A_TickCount),"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
		or (-1=p2:=DllCall("CreateNamedPipe","str",Pipe,"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
	Return 0
	Run, % (Path?Path:A_AhkPath) " `"" Pipe "`"" (IsObject(Args)?"": " " Args),,UseErrorLevel HIDE,P
	If ErrorLevel
		return DllCall("CloseHandle","Ptr",p1),DllCall("CloseHandle","Ptr",p2),0
	DllCall("ConnectNamedPipe","Ptr",p1,"Ptr",0),DllCall("CloseHandle","Ptr",p1),DllCall("ConnectNamedPipe","Ptr",p2,"Ptr",0)
    If Args {
      if !IsObject(Args)
        Args:=[Args]
      sz:=ObjDump(Args,dmp),hex:=BinToHex(&dmp,sz)
      While % _hex:=SubStr(Hex,1 + (A_Index-1)*16370,16370)
        _s.= "hex" (A_Index=1?":":".") "=`"" _hex "`"`n"
      ArgsObj:=StrReplace(h2o,"PLACEHOLDERB29C2D1CA2C24A57BC5E208EA09E162F",_s) "global A_Args:=B29C2D1CA2C24A57BC5E208EA09E162F()`n"
    }
	Return DllCall("WriteFile","Ptr",p2,"Wstr"
			,Script:=chr(0xfeff) ArgsObj
			. "`nglobal h_Caller:=`"" A_ScriptName "`",h_CallerPid:=" ProcessExist() ",h_CallerHwnd:=`"" A_ScriptHwnd "`",h_ScriptDir:=`"" 
			. A_ScriptDir "`"`n" (Tray?"":"#NoTrayIcon") "`nSetWorkingDir," A_WorkingDir "`n" script
			,"UInt",StrLen(Script)*2+4,"uint*",0,"Ptr",0)
		?(DllCall("CloseHandle","Ptr",p2),P):0
}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

21 Feb 2016, 00:28

Thank you.
I suggest you join "`nSetWorkingDir," A_WorkingDir "`n"
I think it is very important.
And the use of static r: = AhkRun__Global ()  
ensure that the code is first loaded.


Now, there are two problems:
1, how to modify A_ScriptDir, now the content is "\\. \ Pipe \", which can not be compatible with normal script.
2, how to get the code of the current script. This can be solved "Reload" issue.

Code: Select all

Reload(){
AhkRun(getScript(),A_ScriptName,A_Args)
}
-----------------------

Code: Select all

AhkRun(Script,Title:="",Args:="",Tray:="",Path:=""){
	if (-1=p1:=DllCall("CreateNamedPipe","str",Pipe:="\\.\pipe\" (Title!=""?Title:"AHK" A_TickCount),"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
		or (-1=p2:=DllCall("CreateNamedPipe","str",Pipe,"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
	Return 0
	Run, % (Path?Path:A_AhkPath) " `"" Pipe "`"" (IsObject(Args)?"": " " Args),,UseErrorLevel HIDE,P
	if IsObject(Args)
	{
		len:=ObjDump(Args,_Args)
		loop  Ceil(StrLen(Hex:=BinToHex(&_Args,len))/16370)
		        _s.= "hex.=`"" SubStr(Hex,1 + (A_Index-1)*16370,16370) "`"`n"
	}
	If ErrorLevel
		return DllCall("CloseHandle","Ptr",p1),DllCall("CloseHandle","Ptr",p2),0
	DllCall("ConnectNamedPipe","Ptr",p1,"Ptr",0),DllCall("CloseHandle","Ptr",p1),DllCall("ConnectNamedPipe","Ptr",p2,"Ptr",0)
	Return s:=DllCall("WriteFile","Ptr",p2,"Wstr"
			,Script:=chr(0xfeff) "Global h_Caller,h_CallerPid,h_CallerHwnd,h_ScriptDir`nAhkRun__Global(){`nstatic r:=AhkRun__Global()"
			. "`n" (Tray?"":"#NoTrayIcon") "`nSetWorkingDir," A_WorkingDir "`n"
			. "`nh_Caller:=`"" A_ScriptName "`",h_CallerPid:=" ProcessExist() ",h_CallerHwnd:=`"" A_ScriptHwnd "`",h_ScriptDir:=`"" A_ScriptDir "`"`n"
			. (_s?(_s ",HexToBin(A_Args,Hex),A_Args:=ObjLoad((&A_Args))`n"):"") "`n}`n" Script
			,"UInt",StrLen(Script)*2+4,"uint*",0,"Ptr",0)
		,DllCall("CloseHandle","Ptr",p2),s?P:0
}
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

21 Feb 2016, 06:59

1. Simply use SetWorkingDir in script if you need it.
2.

Code: Select all

script:=["MsgBox `% A_Args.1","MsgBox `% A_Args.2"]
title:=["test","test2"]
param:=[["A"],["A","B","C"]]
OnMessage(0x9999,"RunScript")
RunScript(1)
RunScript(2)
Return
RunScript(number){
	global
	DynaRun(script[number] "`nReload()`nReload(){`nDetectHiddenWindows,on`nSendMessage,0x9999," number ",,,ahk_id " A_ScriptHwnd "`nExitApp`n}",title[number],param[number])
}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

21 Feb 2016, 15:55

However, I am a little curious, we really can not be modified "A_ScriptDir"? :think:
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

22 Feb 2016, 07:52

Yes we can ;)

Code: Select all

OnMessage(0x9999,"RunScript")
scripts:=[{script:"MsgBox `% A_Args.1 `"``n`" A_ScriptDir",title:"test",param:["A"]},{script:"MsgBox `% A_Args.2 `"``n`" A_ScriptDir",title:"test2",param:["A","B","C"]}]
for k in scripts
  RunScript(A_Index)
Return
RunScript(id){
	global
	DynaRun("
    (Q
    A__ScriptDir := `"" A_ScriptDir "`"
    ScriptStruct().mFileDir[`"`"] := &A__ScriptDir
    " scripts[id].script "
    Reload()
    Reload(){
      SendMessage_(" A_ScriptHwnd ",0x9999," id ")
      ExitApp
    }
    )",scripts[id].title,scripts[id].param)
}
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

22 Feb 2016, 10:15

Thanks. Cool. :D
But I think the "Reload" should not have the aid of other scripts.

Code: Select all

AhkRun(Script,Title:="",Args:="",Tray:="",Path:=""){
	if (-1=p1:=DllCall("CreateNamedPipe","str",Pipe:="\\.\pipe\" (Title!=""?Title:"AHK-" A_TickCount),"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
		or (-1=p2:=DllCall("CreateNamedPipe","str",Pipe,"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
	Return 0
	Run, % (Path?Path:A_AhkPath) " `"" Pipe "`"" (IsObject(Args)?"": " `"" Args "`""),,UseErrorLevel HIDE,P
	if IsObject(Args)
	{
		len:=ObjDump(Args,_Args)
		loop  Ceil(StrLen(Hex:=BinToHex(&_Args,len))/16370)
		        _s.= "hex.=`"" SubStr(Hex,1 + (A_Index-1)*16370,16370) "`"`n"
	}
	If ErrorLevel
		return DllCall("CloseHandle","Ptr",p1),DllCall("CloseHandle","Ptr",p2),0
	DllCall("ConnectNamedPipe","Ptr",p1,"Ptr",0),DllCall("CloseHandle","Ptr",p1),DllCall("ConnectNamedPipe","Ptr",p2,"Ptr",0)
	Return s:=DllCall("WriteFile","Ptr",p2,"Wstr"
			,Script:=chr(0xfeff) "#Include <ScriptStruct>`nGlobal h_Caller,h_CallerPid,h_CallerId,h_CallerHwnd`nAhkRun__Global(){`nstatic A__ScriptDir := `"" A_ScriptDir "`",r:=AhkRun__Global()"
				. "`n" (Tray?"":"#NoTrayIcon") "`nSetWorkingDir," A_WorkingDir "`nScriptStruct().mFileDir[`"`"] := &A__ScriptDir"
				. "`nh_Caller:=`"" A_ScriptName "`",h_CallerPid:=" ProcessExist() ",h_CallerHwnd:=" A_ScriptHwnd ",h_CallerId:=`"" h_id "`""
				. "`n" (_s?(_s ",HexToBin(A_Args,Hex),A_Args:=ObjLoad((&A_Args))`n"):"") "`n}`n" Script
			,"UInt",StrLen(Script)*2+4,"uint*",0,"Ptr",0)
		,DllCall("CloseHandle","Ptr",p2),s?P:0
}
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

22 Feb 2016, 11:39

arcticir wrote:But I think the "Reload" should not have the aid of other scripts.
So where should the script come from?
if you load a script from usb drive and then disconnect usb drive and reload script, you would have the same problem.
You can load the script from AutoHotkey.dll same way we do from the exe, but you would still need a custom procedure to reload the script.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

23 Feb 2016, 00:54

I realized the "Reload" :D

Code: Select all

f:=[]
loop 100
s.="asdfsafsafsafsafsafasfsaf"

loop 1000
f.Push(l:=[s])

AhkRun("ObjTree(h_history)`nMsgBox `% `"Reload `" `nReload()",,[f,f,f])

AhkRun(Script,Title:="",Args:="",Tray:="",Path:=""){
	static fox:=[]
	if Type(Script)="Integer"
	Return cds:=Struct("ULONG_PTR dwData,DWORD cbData,PVOID lpData")
		,cds.lpData:=fox.GetAddress(Script),cds.cbData:=fox.GetCapacity(Script)
		,SendMessage_(StrGet(NumGet(Title + 2*A_PtrSize)),0x4a,1,cds[])
		,OnMessage(0x4a,A_ScriptHwnd,"AhkRun","")
		,fox.Delete(Script),0

	Thread:=IsObject(Script)?Script:{Script:Script},Args?Thread.A_Args:=IsObject(Args)?Args:[Args]:""
		,Thread.Reload?Thread.Reload++:Thread.Reload:=1

        if (-1=p1:=DllCall("CreateNamedPipe","str",Pipe:="\\.\pipe\" (Thread.name?Thread.name:(Thread.name:=Title!=""?Title:"AHK-" A_TickCount)),"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
                or (-1=p2:=DllCall("CreateNamedPipe","str",Pipe,"uint",2,"uint",0,"uint",255,"uint",0,"uint",0,"Ptr",0,"Ptr",0))
        Return 0
        Run, % (Path?Path:A_AhkPath) " `"" Pipe "`"" ,,UseErrorLevel HIDE,P

        If ErrorLevel
                return DllCall("CloseHandle","Ptr",p1),DllCall("CloseHandle","Ptr",p2),0

	Script:=chr(0xfeff) "#Include <ScriptStruct>`nGlobal h_Caller,h_CallerPid,h_CallerId,h_CallerHwnd,h_history`nAhkRun__Global(w:=`"`",l:=`"`"){`nstatic A__ScriptDir := `"" A_ScriptDir "`",r:=AhkRun__Global()`n"
        . "if w`nReturn cds:=Struct(`"ULONG_PTR dwData,DWORD cbData,PVOID lpData`"),cds[]:=l,VarSetCapacity(h_history,cds.cbData)
,DllCall(`"RtlMoveMemory`",PTR,&h_history,PTR,cds.lpData,PTR,cds.cbData),Struct(_AHKVar := `"{Int64 ContentsInt64,Double ContentsDouble,PTR object},{char *mByteContents,LPTSTR CharContents},{UINT_PTR Length,_AHKVar *AliasFor},{UINT_PTR Capacity,UINT_PTR BIV},BYTE HowAllocated,BYTE Attrib,BYTE IsLocal,BYTE Type,LPTSTR Name`",getvar(h_history),{Attrib:1,Length:cds.cbData}),h_history:=ObjLoad(&h_history), h_history.A_Args?A_Args:=h_history.A_Args:0`n"
        . (Tray?"":"#NoTrayIcon") "`n#Singleinstance OFF`nSetWorkingDir," A_WorkingDir "`nScriptStruct().mFileDir[`"`"] := &A__ScriptDir"
                                . "`nh_Caller:=`"" A_ScriptName "`",h_CallerPid:=" (h_CallerPid?h_CallerPid:ProcessExist()) ",h_CallerHwnd:=" A_ScriptHwnd ",h_CallerId:=`"" h_id "`""
        . "`nonmessage(0x4a,`"AhkRun__Global`"),VarSetCapacity(Struct, 3*A_PtrSize, 0) "
        . "`nNumPut((StrLen(Hwnd:=A_ScriptHwnd) + 1) * 2, Struct, A_PtrSize)"
        . ",NumPut(&Hwnd, Struct, 2*A_PtrSize)"
        . ",SendMessage_(" A_ScriptHwnd ",0x4a," P ",&Struct)`nonmessage(0x4a,`"AhkRun__Global`",`"`")`n}`nReload(){`nAhkRun(h_history)`nExitApp`n}`n" Thread.Script

	len:=ObjDump(Thread,data2)
	DllCall("ConnectNamedPipe","Ptr",p1,"Ptr",0),DllCall("CloseHandle","Ptr",p1),DllCall("ConnectNamedPipe","Ptr",p2,"Ptr",0)
	if s:=DllCall("WriteFile","Ptr",p2,"Wstr",Script,"UInt",StrLen(Script)*2+4,"uint*",0,"Ptr",0)
	{
		fox.SetCapacity(P,len),RtlMoveMemory(fox.GetAddress(P),&data2,len)
		,OnMessage(0x4a,A_ScriptHwnd,"AhkRun"),DllCall("CloseHandle","Ptr",p2),t:=A_TickCount
		Sleep, 15
		while fox.HasKey(P) and ((A_TickCount-t)<5000)
		Sleep, -1
		if fox.HasKey(P)
		OnMessage(0x4a,A_ScriptHwnd,"AhkRun",""),fox.Delete(P)
	}
	Return s?P:(DllCall("CloseHandle","Ptr",p2),0)

}
------------------------------------
Also, a need to fix minor problems:

Code: Select all

s:=[]
s.1:=""
len:=ObjDump(s,data2)
h_history:=ObjLoad(&data2)
MsgBox % ObjTree(h_history)
Image
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

23 Feb 2016, 07:15

Well done :)
I would not have Tray as a parameter, it is very simple to add #NoTrayIcon to the script and default should be to have a tray icon. Same for #Singleinstance, user should decide.
Also no need to #Include <ScriptStruct> as it will be loaded automatically.

I will look into ObjTree asap.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

23 Feb 2016, 07:23

But this is more like "AHKDLL" the use of.
I'm going to put it, and "AHKDLL" mix.
must use #Include <ScriptStruct>
Because it:
static r:=AhkRun__Global()

Now the problem from ObjLoad() ;)


I released it in Chinese Forum
https://autohotkey.com/boards/viewtopic ... 954#p72954
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: [Lib] ObjDump / ObjLoad - Object Backup

23 Feb 2016, 07:39

I have an idea.
Can we specify AHKDLL title?
Recently I have been testing AhkRun ()  
It has the advantage, you can set the title,  
so we can quickly know who it is.
Image
But all AHKDLL title are the same. We can not tell who it is.
Image


----------------------------------------------


Also, we could use more low-level code to implement "ObjDump / ObjLoad"? similar "InStr() or RegExMatch()"
I think we should maximize the upgrading of its performance.
Because they are very important.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: [Lib] ObjDump / ObjLoad - Object Backup

25 Feb 2016, 11:44

I have fixed the error in ObjLoad.
ObjDump and ObjLoad can now handle object reference to itself or another object within dumped object.

Code: Select all

obj:=["test",["test2"]]
obj.3:=obj
obj.4:=obj.2
ObjDump(obj,var)
newobj:=ObjLoad(&var)
MsgBox % obj.3.1 "`n" obj.4.1
ObjDump and ObjLoad are now build-in in AutoHotkey_H and are 10++ times faster ;)

AutoHotkey.dll Title:

Code: Select all

ahkdll:=AhkThread("ScriptStruct().mFileName[`"`"] := &`"AhkDll`",  MsgBox(`"Message from ahkdll`")")
While ahkdll.ahkready()
  sleep 100

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 139 guests