AutoHotkey Community

It is currently May 26th, 2012, 7:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 37 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: May 20th, 2008, 5:55 pm 
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

    Image

    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²

    Image

  • 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


:)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2008, 9:15 pm 
Very cool! 8)

Now add some compression algorithm stuff... stirr a bit... and poof :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2008, 4:05 am 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
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!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2008, 8:03 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
n-l-i-d wrote:
Very cool! 8)


Thanks daonlyfreez! :)

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 ;)
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/viewtop ... 153#190153

Rhys wrote:
Excellent release, SKAN!


Thanks Rhys! :)

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 ... tastru.htm

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2008, 8:54 pm 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
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. :D

_________________
.o0[ corey ]0o.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 1:57 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
freakkk wrote:
this is a great demonstration of your lib ideas for a much needed binary storage solution.


Thanks for the nice words, friend. :)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 22nd, 2008, 2:35 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
    Icon Flipper 60L - A Memory and Concentration based Game.
    Snapshot: ss_iconflipper.png 125.46 KiB
    Image

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



    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

    :)


PS: On a non-related note, here is the previous version of this game : Crazy Scripting : Dingbat Flipper 45L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 4:55 am 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
SKAN, you got a perfect score in 6 seconds - amazing! :o

_________________
[Join IRC!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 8:28 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 8:47 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2008, 4:19 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
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!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 3rd, 2008, 4:58 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
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!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 3rd, 2008, 5:39 pm 
Offline

Joined: October 11th, 2006, 5:27 am
Posts: 27
How about AxC_Delete(???)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 3rd, 2008, 6:52 pm 
Offline

Joined: April 17th, 2007, 1:37 pm
Posts: 761
Location: Florida
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!]
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 3rd, 2008, 8:38 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Rhys wrote:
I believe I've found and fixed a bug with axc_unpackall().


Many thanks for reporting it, and for the bugfix. :D

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.

:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 37 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Bing [Bot], siterip, Stigg and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group