Thanks. This awesome ~
I have more hope, Title becomes the default parameters.
[Lib] ObjDump / ObjLoad - Object Backup
Re: [Lib] ObjDump / ObjLoad - Object Backup
BUG
Code: Select all
obj:=["test",[11]]
ObjDump(obj,var)
newobj:=ObjLoad(&var)
MsgBox % ObjTree(newobj)
Re: [Lib] ObjDump / ObjLoad - Object Backup
This should be fixed now, additionally ObjDump will compress data to reduce size
Re: [Lib] ObjDump / ObjLoad - Object Backup
Thanks.
But I do not agree with your ideas.
I define it: OBJ ← → Var
Clearly file and encryption does not belong to it.
Because it greatly affects the performance of the function:
Older: (20 millisecond)
The new: (1.2 second)
ObjLoad () change not good, This means I have a lot of scripts need to be modified. = =
---------------------
we can use the built-in encryption and decryption function to ZIP files?
I now use 7z. exe, I would like to get rid of it.
But I do not agree with your ideas.
I define it: OBJ ← → Var
Clearly file and encryption does not belong to it.
Because it greatly affects the performance of the function:
Older: (20 millisecond)
Code: Select all
Timing := A_TickCount, Counter :=Counter()
f:={a:"a"}
Loop 10000
{
r:=ObjDump(f,a)
i:=ObjLoad(&a)
}
MsgBox % Counter(Counter) A_Tab A_TickCount - Timing
Counter(s:=0) {
static Frequency := QueryFrequency()
DllCall("QueryPerformanceCounter",Int64P,Counter)
Return (s ? (Counter-s)/Frequency : Counter)
}
QueryFrequency(){
DllCall("QueryPerformanceFrequency",Int64P,F)
Return F
}
Code: Select all
Timing := A_TickCount, Counter :=Counter()
f:={a:"a"}
Loop 10000
{
r:=ObjDump(f,a)
i:=ObjLoad(&a,r)
}
MsgBox % Counter(Counter) A_Tab A_TickCount - Timing
Counter(s:=0) {
static Frequency := QueryFrequency()
DllCall("QueryPerformanceCounter",Int64P,Counter)
Return (s ? (Counter-s)/Frequency : Counter)
}
QueryFrequency(){
DllCall("QueryPerformanceFrequency",Int64P,F)
Return F
}
---------------------
we can use the built-in encryption and decryption function to ZIP files?
I now use 7z. exe, I would like to get rid of it.
Re: [Lib] ObjDump / ObjLoad - Object Backup
I have changed ObjDump not to compress data by default.
Re: [Lib] ObjDump / ObjLoad - Object Backup
New error
Error: CONTINUABLE EXCEPTION_ACCESS_VIOLATION
Mouse and Keyboard hooks have been disabled.
- Press yes to exit thread and continue execution.
- Press no to continue thread (debug).
- Press cancel to exit application.
Exception was caused in thread id: 9328
Line: 5
Specifically: ObjDump(f,a)
LineFile: C:\03月03日_New.ahk
-
- Posts: 137
- Joined: 01 Jul 2017, 03:04
Re: [Lib] ObjDump / ObjLoad - Object Backup
the keys are missing
AutoHotkey v1
I did as you did.
AutoHotkey v1
Code: Select all
arr := {" 11":"888 ","11 ":" 999"}
for k, v in arr
MsgBox, , Original, % "|" k "|" v "|"
ObjDump(arr,Obj)
for k, v in ObjLoad(&Obj)
MsgBox, , ObjLoad, % "|" k "|" v "|"
Spoiler
Re: [Lib] ObjDump / ObjLoad - Object Backup
Thanks, that should be fixed now.
Note, your version converts everything to strings which is not appropriate and will increase memory and affect speed!
Note, your version converts everything to strings which is not appropriate and will increase memory and affect speed!
-
- Posts: 137
- Joined: 01 Jul 2017, 03:04
Re: [Lib] ObjDump / ObjLoad - Object Backup
But I have no such problem.
Code: Select all
arr := {" 11":"42949672954294967295","11 ":"-42949672954294967295"}
for k, v in arr
MsgBox, , Original, % "|" k "|" v "|"
ObjDump(arr,Obj)
for k, v in ObjLoad(&Obj)
MsgBox, , ObjLoad, % "|" k "|" v "|"
Re: [Lib] ObjDump / ObjLoad - Object Backup
When I run this example:
... the returned object from the load function appears return {a:1,b:2,c:[1,2,"test"],d:0.00000} instead of the original. Not only is the element "d" demoted, the value has gone from integer to a float. Should it not faithfully reproduce the original object?
Relayer
Code: Select all
obj:={a:1,b:2,c:[1,2,"test"],d:{a:0}}
ObjDump(A_ScriptDir "\Test.bin",obj)
for k,v in ObjLoad(A_ScriptDir "\Test.bin")
If !IsObject(v)
MsgBox % "Parent:`n" k ": " v
else for k,v in v
MsgBox % "Child:`n" k ": " v
Relayer
Re: [Lib] ObjDump / ObjLoad - Object Backup
Both should work fine now.
Re: [Lib] ObjDump / ObjLoad - Object Backup
I read that compression was once possible. But was removed for storage in a variable.
Is compression still being done for file or Is it still optional available/possible?
Is compression still being done for file or Is it still optional available/possible?
ciao
toralf
toralf
Re: [Lib] ObjDump / ObjLoad - Object Backup
Compression is only supported in AHK_H build in func: http://hotkeyit.github.io/v2/docs/commands/ObjDump.htm
For this lib func you will have to compress afterwards using for example VarZ: https://autohotkey.com/board/topic/4195 ... mpression/.
For this lib func you will have to compress afterwards using for example VarZ: https://autohotkey.com/board/topic/4195 ... mpression/.
Re: [Lib] ObjDump / ObjLoad - Object Backup
Thanks for the reference.
That lib seems to only compress the Content of a variable.
I was looking for a way to compress the dumped file as a whole (before writing it to file).
That lib seems to only compress the Content of a variable.
I was looking for a way to compress the dumped file as a whole (before writing it to file).
ciao
toralf
toralf
Re: [Lib] ObjDump / ObjLoad - Object Backup
Yes, you can write the variable to file after compression.
-
- Posts: 4344
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: [Lib] ObjDump / ObjLoad - Object Backup
There is a bug in ObjDump().
Since file encoding could be UTF-8 or UTF-16, obviously the code must be:
Code: Select all
f:=FileOpen(obj,"rw-rwd"),VarSetCapacity(v,sz:=RawObjectSize(var,mode)+8,0)
Code: Select all
f:=FileOpen(obj,"rw-rwd"),f.Pos := 0
Re: [Lib] ObjDump / ObjLoad - Object Backup
I downloaded the v2 versions. Getting error:
Error in #include file "J:\StandaloneApps\AutoHotkeyV2\Lib\ObjDump.ahk":
Type mismatch.
Line#
046: objects[obj]:=1
047: For k,v in obj
048: {
049: if IsObject(k)
050: sz+=objects.HasKey(k)?9:RawObjectSize(k,buf,objects)+9
051: Else
051: if Type(k)="String"
---> 052: sz+=StrPut(k)*2+9
053: Else
053: sz+=InStr(k,".")||k>4294967295?9:k>65535?5:k>255?3:k>-129?2:k>-32769?3:k>-2147483649?5:9
054: if IsObject(v)
055: sz+=objects.HasKey(v)?9:RawObjectSize(v,buf,objects)+9
056: Else
056: if Type(v)="String"
057: sz+=(buf?obj.GetCapacity(k):StrPut(v)*2)+9
The current thread will exit.
Re: [Lib] ObjDump / ObjLoad - Object Backup
Thanks that has been updated to f:=FileOpen(obj,"rw-rwd","CP0").teadrinker wrote:There is a bug in ObjDump().Since file encoding could be UTF-8 or UTF-16, obviously the code must be:Code: Select all
f:=FileOpen(obj,"rw-rwd"),VarSetCapacity(v,sz:=RawObjectSize(var,mode)+8,0)
Code: Select all
f:=FileOpen(obj,"rw-rwd"),f.Pos := 0
Re: [Lib] ObjDump / ObjLoad - Object Backup
Please provide full example.SAbboushi wrote:I downloaded the v2 versions. Getting error:
Error in #include file "J:\StandaloneApps\AutoHotkeyV2\Lib\ObjDump.ahk":
Type mismatch.
Line#
046: objects[obj]:=1
047: For k,v in obj
048: {
049: if IsObject(k)
050: sz+=objects.HasKey(k)?9:RawObjectSize(k,buf,objects)+9
051: Else
051: if Type(k)="String"
---> 052: sz+=StrPut(k)*2+9
053: Else
053: sz+=InStr(k,".")||k>4294967295?9:k>65535?5:k>255?3:k>-129?2:k>-32769?3:k>-2147483649?5:9
054: if IsObject(v)
055: sz+=objects.HasKey(v)?9:RawObjectSize(v,buf,objects)+9
056: Else
056: if Type(v)="String"
057: sz+=(buf?obj.GetCapacity(k):StrPut(v)*2)+9
The current thread will exit.
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 108 guests