AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AxC² - AutoHotkey Cabinet v1.00
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN!
Guest





PostPosted: Tue May 20, 2008 4:55 pm    Post subject: AxC² - AutoHotkey Cabinet v1.00 Reply with quote

Quote:
AxC² is an improvised wrapper version and is incompatible with the earlier version.
Please refer the old topic for introduction : AxC : Pack and Unpack Binary files
The File Structure and CRC32 code has been changed. Facility has been made to include the sub folder structure



    Credit: The Machine code for CRC32 was developed by Laszlo Hars.

    Download : AxC.ahk 9 KiB ( 166 Lines )





    The following project demonstrates the usage of AxC²



  • Resize/Maximize window to fit needs
  • Simple but fast InStr() based filter
  • Accelerator Keys / Hotkeys
    • Alt+C - copy edit contents to clipboard
    • Alt+N - Open text in Notepad
    • Alt+X - Expand / Collapse entire TreeView
    • Alt+F - Set filter based on user input
    • Alt+R - Reset filter and Reload Treeview


    Download : ebook.zip 905.29 KiB

    The above archive does not contain the wrapper as whole but the main functions have been pasted into the relevant ahk files.

    Only ebook.axc and ebook.ahk are neccessary for the end user. The other files are project files that shows how to pack/unpack an AxC² file.

    How to update the ebook ?
  • Run unpack ebook.ahk to explode the contents of ebook.axc into the subfolder named Text-Files
  • Browse the subfolder Text-Files, add/delete files and/or make any alterations, and then
  • Run create ebook.ahk, to re-create ebook.axc



Smile
Back to top
n-l-i-d
Guest





PostPosted: Tue May 20, 2008 8:15 pm    Post subject: Reply with quote

Very cool! Cool

Now add some compression algorithm stuff... stirr a bit... and poof Wink
Back to top
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Wed May 21, 2008 3:05 am    Post subject: Reply with quote

Excellent release, SKAN! I really like the table you used up top to explain the structure of the header and csv - I'm guessing that it was created in a version of Excel?
_________________
[Join IRC!]
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed May 21, 2008 7:03 am    Post subject: Reply with quote

n-l-i-d wrote:
Very cool! Cool


Thanks daonlyfreez! Smile

n-l-i-d wrote:
Now add some compression algorithm stuff... stirr a bit... and poof Wink


Someday, I might try my luck with the zip format Wink
In case you were not aware, I had demonstrated the loading of an bitmap image directly from a .zip file with an external unzip.dll :

http://www.autohotkey.com/forum/viewtopic.php?p=190153#190153

Rhys wrote:
Excellent release, SKAN!


Thanks Rhys! Smile

Quote:
I really like the table you used up top to explain the structure of the header and csv - I'm guessing that it was created in a version of Excel?


I do crazy things often.. It is a cropped-screenshot of HTML-displayed-in-Browser
http://www.autohotkey.net/~Skan/wrapper/AxC2/datastru.htm

Smile
Back to top
View user's profile Send private message Send e-mail
freakkk



Joined: 29 Jul 2005
Posts: 179

PostPosted: Wed May 21, 2008 7:54 pm    Post subject: Reply with quote

Thanks for sharing this!

Will take much analysis before I can comment further, but this is a great demonstration of your lib ideas for a much needed binary storage solution. Very Happy
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu May 22, 2008 12:57 am    Post subject: Reply with quote

freakkk wrote:
this is a great demonstration of your lib ideas for a much needed binary storage solution.


Thanks for the nice words, friend. Smile
Back to top
View user's profile Send private message Send e-mail
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu May 22, 2008 1:35 am    Post subject: Icon Flipper 60L - A Memory and Concentration based Game. Reply with quote


    Icon Flipper 60L - A Memory and Concentration based Game.
    Snapshot: ss_iconflipper.png 125.46 KiB


    Credit: Graphic Buttons posted by corrupt .. Many thanks! Smile



    The Game:
    On load, the GUI will contain 36 pairs of identical Icons, hidden. You have to flip open each of them and find the matching pairs. Consecutive flips on an identical pair earns you them. The catch: No more than two Icons will be visible at a given time. You have to fully rely on your memory and concentration to play this Game. To finish the game, you will have to find all the 36 pairs.

    Download : IconFlipper-60L.zip (71.48 KiB)

    Only IconFlipper-60L.ahk and icons.axc are needed for the game play. Two more scripts have been provided in the archive to unpack/pack icons from/to the AxC file.

    How to update icons.axc?

  • Run unpack icons.ahk to explode the icons from icons.axc into the subfolder named 32x32-32bit

  • Browse the subfolder 32x32-32bit, replace any/all Icons, but make sure
    • There are no more than 36 Icons
    • Each ICO files contain a single 32x32 32bit frame only ( check the file size and it should be exactly 4286 bytes )

  • Run create axc.ahk, to re-create icons.axc

    Smile


PS: On a non-related note, here is the previous version of this game : Crazy Scripting : Dingbat Flipper 45L
Back to top
View user's profile Send private message Send e-mail
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Thu May 22, 2008 3:55 am    Post subject: Reply with quote

SKAN, you got a perfect score in 6 seconds - amazing! Surprised
_________________
[Join IRC!]
Back to top
View user's profile Send private message
z80
Guest





PostPosted: Thu May 22, 2008 7:28 pm    Post subject: Reply with quote

Hey SKAN!,

Great work!! I like the ebook example and was wondering how it could possibly be modified to work with html using IE.ahk.

I can see that it would be simple to modify for use with html pages that are fully self contained.

But could it be modified to use html pages that need additional files that are contained in a sub-directory of the AXC file?

Thanks again, z80.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu May 22, 2008 7:47 pm    Post subject: Reply with quote

z80 wrote:
could it be modified to use html pages that need additional files that are contained in a sub-directory of the AXC file?


The additional files have to be stored in a seperate DLL ( or inside AutoHotkeySC.bin if you are compiling your script ) and those resources can be referenced from HTML.

So, there is no need for AxC .. the HTML files too, can be stored as resources.

Lexikos showed me the way in this topic : Is there a way to load HTML fm memory into IE Control ?
Back to top
View user's profile Send private message Send e-mail
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Wed Jun 11, 2008 3:19 pm    Post subject: Reply with quote

Working on a function that will return the newest file date in the AxC - This works but still needs to be turned into a function... I might use this to get a remote AxC file and check it against a local one in order to replace if the remote file has newer data...
Code:
URLDownloadToFile,http://www.autohotkey.net/~Rhys/Junk/test.axc,local.axc
URLDownloadToFile,http://www.autohotkey.net/~Rhys/Junk/test_newer.axc,remote.axc

FileReadEx((local_axc:="local.axc"),hdr,8,12 )
FileReadEx((remote_axc:="remote.axc"),hdr,8,12 )
FileReadEx(local_axc,local_csv,numget(hdr,4),numget(hdr))
FileReadEx(remote_axc,remote_csv,numget(hdr,4),numget(hdr))

Local_Date:=Remote_Date:=0
Loop,Parse,local_CSV,`r,`n
{
  Loop,Parse,A_LoopField,CSV
  If (A_Index = 5) && (A_Loopfield > Local_Date)
    Local_Date:=A_LoopField
}
Loop,Parse,remote_CSV,`r,`n
{
  Loop,Parse,A_LoopField,CSV
  If (A_Index = 5) && (A_Loopfield > Remote_Date)
    Remote_Date:=A_LoopField
}

MsgBox, %Local_Date%-Local`n%Remote_Date%-Remote
Return



FileReadEx( F,ByRef V,B,O=0 ) {
 by:= (B<0 ? ABS(B-1) : B), varsetcapacity(V,By,0), h:=dllcall("_lopen",str,f,int,0)
 ifless,h,1,return, -1
 dllcall("_llseek",uint,h,int,( B < 0 ? B : O), uint,(B < 0 ? 2 : 0))
 return dllcall("_lread",uint,h,str,V,int,by) . (dllcall("_lclose",uint,h)+wm_null)     
}

_________________
[Join IRC!]
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Wed Sep 03, 2008 3:58 pm    Post subject: Reply with quote

I believe I've found and fixed a bug with axc_unpackall(). I noticed recently that the modified time when unpacking files was always the moment they were unpacked, rather than the date stored in the AxC² header... The changes in red below seem to fix it:
Code:
axc_unpackall( packfile,dir="",progress="axm_progress" ) {
  ifequal,dir,,setenv,dir,%a_workingdir%
  u:="uint",i:="int",s:="str",h:=dllcall("_lopen",s,packfile,i,0),varsetcapacity(x,4,0)
  varsetcapacity(hdr,24),dllcall("_lread",u,h,s,hdr,i,24),fls=numget(hdr,8),f:=0
  if (h<1||(numget(hdr)<>0xB2437841)||(numget(hdr,4)<>0x3F800000)||fls<1)
{ dllcall("_lclose",u,h)
  return -1
} varsetcapacity(z,1),dllcall("_lread",u,h,s,z,i,1),z:=asc(z),varsetcapacity(crc,z)
  dllcall("_lread",u,h,s,crc,i,z),csvof:=numget(hdr,12),csvsz:=numget(hdr,16)
  dllcall("_llseek",u,h,i,csvof,i,0),varsetcapacity(csv,csvsz)
  dllcall("_lread",u,h,s,csv,i,csvsz)
  if ( dllcall(&CRC,s,csv,u,csvsz,i,-1,u,0x04C11DB7,"cdecl uint") <> numget(hdr,20) )
{ dllcall("_lclose",u,h)
  return -2
} loop,parse,csv,`n
{ loop, parse, a_loopfield, csv
  f%A_Index%:=a_loopfield
  dllcall("_llseek",u,h,i,f3,i,0),varsetcapacity(bin,f2),dllcall("_lread",u,h,s,bin,i,f2)
  If ((e:=dllcall(&CRC,s,bin,u,f2,i,-1,u,0x04C11DB7,"cdecl uint")+0)<>f4)
{ msgbox,16,Checksum Error!,CRC32 failed on %f1% %e%
  continue
} ifnotexist,% (tf:=dir "\" f7),filecreatedir,%tf%
  ifnotequal,progress,,setenv,dummy,% %progress%(f1,a_index,fls,packfile)
  h2:=dllcall("_lcreat",s,tf "\" f1,i,0),f:=f+1
  dllcall("_lwrite",u,h2,s,bin,u,f2),dllcall(lc,u,h2)
  filesettime,%f5%,%tf%\%f1%,c
  filesettime,%f5%,%tf%\%f1%,m
  filesetattrib,+%f6%,%tf%\%f1%
} Return f+dllcall("_lclose",u,h)
}

_________________
[Join IRC!]
Back to top
View user's profile Send private message
ZeLen1y



Joined: 11 Oct 2006
Posts: 27

PostPosted: Wed Sep 03, 2008 4:39 pm    Post subject: Reply with quote

How about AxC_Delete(???)
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 761
Location: Florida

PostPosted: Wed Sep 03, 2008 5:52 pm    Post subject: Reply with quote

I haven't used / looked at it. Have you encountered a problem? If so, please elaborate and maybe myself or someone else can help.
_________________
[Join IRC!]
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed Sep 03, 2008 7:38 pm    Post subject: Reply with quote

Rhys wrote:
I believe I've found and fixed a bug with axc_unpackall().


Many thanks for reporting it, and for the bugfix. Very Happy

ZeLen1y wrote:
How about AxC_Delete(???)


My main concern is that: If a file is removed from AxC, all the offsets would change and the user will have to extensively re-script the code if FileReadEx() is being used. Moreever, the resulting function would be as good as unpacking and packing the files again.

I will look into what can be done. thanks for the suggestion.

Smile
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group