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 

Efficient binary objects embedding in AHK code - ASCII 85
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sarah



Joined: 12 Jul 2007
Posts: 90
Location: Hawaii, USA

PostPosted: Fri Mar 21, 2008 10:59 am    Post subject: Reply with quote

Quote:
I can't respond to you directly since I've not had time to dig into Skan's lib. Sorry Sad


No worries & thank you! Very Happy
Back to top
View user's profile Send private message
Joy2DWorld



Joined: 04 Dec 2006
Posts: 424
Location: Galil, Israel

PostPosted: Fri Mar 21, 2008 1:21 pm    Post subject: Reply with quote

majkinetor wrote:
Quote:
majkinetor : looks like it's exactly the purpose of skan's AxC : Pack and Unpack Binary files which offers the following functionnality :

Not in the manner I proposed. Its completely different project, looking similar at first glance


your idea is good.

under 10 min. to code...


read file into var,
convert to ascii85

regex per my prev. posted code (mod to include ` and % options in concat)

wrap in function name to return val as bin...

done.


or so it seems if understood the idea...
_________________
Joyce Jamce
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3652
Location: Belgrade

PostPosted: Fri Mar 21, 2008 3:03 pm    Post subject: Reply with quote

Yes, exactly.
I would go ahead and create file system structure if possible similar to ScriptMerge.

Acctually, the concept generaly doesn't have so much benefits unless something similar to RAM drives is used.

To clearify this: lets say you have several files each of differnet type, so you may have some pictures, some sounds, some arbitrary binary data, and in most of the time it will need to have location on the HD, i.e. path that it can be accessed. But then to use resource.ahk you would need to unpack it in temporrary folder (existing solution for bitmaps is clearly not enough) which defets the purpose great deal. I would like to use resource.ahk as a file system, without temporary files.

While this is possible to do with something similar to RAM drives, or maybe even virtual folders (maybe I say), I am not sure how it can be done nor how much complexity it involves.

Actually, this would be abstraction of ScriptMerge. It would let you include arbitrary files into your ahk file, and use the resources in memory. It would also be possible to unpack everything back if you want to speed up things.

Would be very valuable IMO.
_________________
Back to top
View user's profile Send private message MSN Messenger
Sarah



Joined: 12 Jul 2007
Posts: 90
Location: Hawaii, USA

PostPosted: Fri Mar 21, 2008 3:52 pm    Post subject: Reply with quote

Trying to stay on topic here --- but can this actually be used to embed a .wav file, for instance in my AHK program, and play such file runtime? If so, how would I approach that code wise? Smile Thank you so much for this thread Azerty, Majkinetor, to make me understand Smile

I guess what I am asking is..... can a .WAV be referenced like a Image... without regenerating it to a file which would be useless to me but useful in the sense you would be sort of encapsulating all of the data before running final product. Best wishes, Sarah. Very Happy

i.e.

IMAGES > PNG, GIF, JPG >>> Display directly from binary without creating File

.EXE, other assets must be regenerated to a file

.WAVE??? sounds??? can they be just played directly from binary or am I way off base? Rolling Eyes Razz
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Fri Mar 21, 2008 3:59 pm    Post subject: Reply with quote

I wonder… If you embed hex encoded data in your AHK script instead of ascii85, when you compile it, the data gets compressed. Will it result in similar code sizes? Ascii85 could still have an advantage: less temporary memory.
Back to top
View user's profile Send private message
Azerty



Joined: 19 Dec 2006
Posts: 72
Location: France

PostPosted: Fri Mar 21, 2008 4:40 pm    Post subject: Reply with quote

sarah : using PlaySound() API through DllCall() should do the trick using SND_MEMORY flag. See here. As for JPeG, BMP & al, browsing through the forum should help you find the trick (look at samples like hardcopy scripts, for instance, to see how to manipulate images in memory).

Laszlo : it should be tested, since ASCII (charset of 85 chars) is also compressible (though might be slightly less than pure hexa). It probably depends on the complexity of the source binary data, and results might differ from one test to another.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3652
Location: Belgrade

PostPosted: Fri Mar 21, 2008 6:13 pm    Post subject: Reply with quote

Quote:
Sarah : using PlaySound() API through DllCall() should do the trick using SND_MEMORY flag. See here. As for JPeG, BMP & al, browsing through the forum should help you find the trick (look at samples like hardcopy scripts, for instance, to see how to manipulate images in memory).

Ye, there are solutions to each multimedia type, but they are specific and not uniformed. I am more interested in finding general solution. I see that Azerty don't have any interest in that, so it would probably have to be done by somebody else. Laszo's ideas about comiled executable definitely gives more attention to such approach, as you would be able to pack any of your resources in the 1 exe file.
_________________
Back to top
View user's profile Send private message MSN Messenger
Azerty



Joined: 19 Dec 2006
Posts: 72
Location: France

PostPosted: Fri Mar 21, 2008 10:52 pm    Post subject: Reply with quote

Majkinetor : yes, for now I'm not directly interested in this problem, since I've got my own, so I'm just trying to give useful clues to Sarah to help him (or perhaps her ?, sorry if I'm mistaken, you'll correct me in your next answer) find his way with the direct question he asks. As for most people here, I try to answer our direct needs and offer our solutions to the community

As for a general solution, I'm no expert in MM questions, but it looks to me like the only generic interface is MCI, which does not offer direct in-memory handling for now from what's I've rapidly browsed in MSDN.

Nonetheless, if you offer us a generic solution to handle in-memory MM data, we'll all be glad to use the library you might provide us if you've got a more profound interest in this precise topic.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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