dbzfanatic Posted September 3, 2008 Share Posted September 3, 2008 How do I compress a file in autoit? Is there a UDF or an algorithm I can use? I've looked around but didn't find anything. I don't want to use standard zip or rar compression so is there a way I can make my own or use a different kind in autoit? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 3, 2008 Share Posted September 3, 2008 How do I compress a file in autoit? Is there a UDF or an algorithm I can use? I've looked around but didn't find anything. I don't want to use standard zip or rar compression so is there a way I can make my own or use a different kind in autoit?7-zip...? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 No that's no fun I want to do it in pure autoit. I've tried reading a file in binary mode to try to make my own simple method but it seems to return hex instead of binary, did I do something wrong? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Pain Posted September 3, 2008 Share Posted September 3, 2008 (edited) zip udf: http://www.autoitscript.com/forum/index.php?showtopic=44524http://www.autoitscript.com/forum/index.php?showtopic=73425 Edited September 3, 2008 by Pain Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 ... I don't want to use standard zip or rar compression ...Enough said. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 3, 2008 Share Posted September 3, 2008 No that's no fun I want to do it in pure autoit. I've tried reading a file in binary mode to try to make my own simple method but it seems to return hex instead of binary, did I do something wrong?No, that's how things work. You should use Binary(), BinaryToString() etc to convert between formats. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 I tried that as well, it still showed up as 0x*hex string*. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Airwolf Posted September 3, 2008 Share Posted September 3, 2008 (edited) AutoIt has UPX built-in to compress your scripts. If you are only referring to a "zip" type compression, then the fact that it is an AutoIt file is irrelevant. There are many compression utilities available; what would be the point of creating your own? You'd be the only person who could de-compress it. If encryption is what you're after, then try TrueCrypt. Edited September 3, 2008 by Airwolf Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 (edited) I'm trying to create a simple compression method in autoit just for fun. If it works and is viable I'd actually post the code and encryption isn't really what I'm seeking. I want to have a compression algorithm written completely in autoit if at all possible, and really just want to prove to myself that I can with or without help. Also as a clarification I'm not trying to compress my scripts, I want the method to compress other files. Edited September 3, 2008 by dbzfanatic Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2008 Moderators Share Posted September 3, 2008 If you're using the latest beta, you can use StringToASCIIArray() after reading the file, and work with each individual decimal character value by itself. The hex for StringToBinary/BinaryToString is so you can read the characters in a message box or console, otherwise the "string" would be cut off at any non-printable character. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 Thanks, I'll try that. By the way, what file is that in? I included String.au3 and Array.au3 but it still says undefined function. I have the latest beta installed and I'm running the full version of SciTe. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2008 Moderators Share Posted September 3, 2008 Thanks, I'll try that. By the way, what file is that in? I included String.au3 and Array.au3 but it still says undefined function. I have the latest beta installed and I'm running the full version of SciTe.It's not in any file, it's a standard function in the beta. Make sure you not only have the latest beta, but you are actually trying to run it (Alt+F5 in SciTe). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 *Slaps forehead* D'oh! I was pressing F5 and not Alt+F5. Thank you. Is there a way to see if a number is prime and if not find the largest number it can be divided by? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Airwolf Posted September 3, 2008 Share Posted September 3, 2008 You should be able to use FileOpen() in binary/byte mode. Then use a FileRead() as usual on that file. $file = FileOpen("filename.exe",16) $binarydata = FileRead($file) Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2008 Moderators Share Posted September 3, 2008 *Slaps forehead* D'oh! I was pressing F5 and not Alt+F5. Thank you. Is there a way to see if a number is prime and if not find the largest number it can be divided by?Search for IsPrime() on the forum and look at Mod() in the help file for the 2nd part of your question. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 (edited) Already tried it. Didn't seem to work as needed. @ Sm0ke_N ok thank you. Edited September 3, 2008 by dbzfanatic Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 3, 2008 Moderators Share Posted September 3, 2008 (edited) Already tried it. Didn't seem to work as needed.Sorry, the crystal ball is broken today, and my remote desktop session to your PC seems to have expired.Please don't make us run in circles... don't say things like the above without posting code you've actually tried, what results you get when you try the code, and what you wish the desired output to be.Edit:I'm going to assume you were speaking to the other gent with your post... after seeing your edit. Edited September 3, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 Sorry, the crystal ball is broken today, and my remote desktop session to your PC seems to have expired.Please don't make us run in circles... don't say things like the above without posting code you've actually tried, what results you get when you try the code, and what you wish the desired output to be.Edit:I'm going to assume you were speaking to the other gent with your post... after seeing your edit.I was and I have already posted example output from reading in Binary Mode. It was output as a hex string instead of a binary, which PsaltyDS seemed to explain was so that it wouldn't crash when it came upon a non-printable character,which makes sense. However I'm the type of person who needs to see the exact data being worked with so for me this isn't a viable solution unless I can get a bit more help. I've tried a few different methods up to this point,changing the code around so I have none to post ATM, and all of it either resulted in the same filesize or a greater size. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Airwolf Posted September 3, 2008 Share Posted September 3, 2008 I was and I have already posted example output from reading in Binary Mode. It was output as a hex string instead of a binary, which PsaltyDS seemed to explain was so that it wouldn't crash when it came upon a non-printable character,which makes sense. However I'm the type of person who needs to see the exact data being worked with so for me this isn't a viable solution unless I can get a bit more help. I've tried a few different methods up to this point,changing the code around so I have none to post ATM, and all of it either resulted in the same filesize or a greater size.It definitely helps to post your source code. It's hard to fix an engine problem in a car without having it in front of you. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
dbzfanatic Posted September 3, 2008 Author Share Posted September 3, 2008 Here's the code I've gotten up to. I'm aware that it sucks but I'm tired and I'm going to go to sleep, maybe I'll be able to think more clearly when I wake up. Have a look and see if you can give any suggestions. There is an error that the array $binary somehow gets reset to nothing but I don't understand how.expandcollapse popup#include <String.au3> #include <Array.au3> Dim $n, $f, $binary_encrypted, $pass, $pass2 $binary = FileOpen("concept.txt",16) $binary = FileRead($binary) $binary = StringToAsciiArray($binary) For $n = 0 To UBound($binary) - 2 $f = $n + 2 $pass = $binary[$f] $pass2 = $pass2 & $pass & "|" $n = $n + 1 Next $pass = StringSplit($pass2,"|") $pass2 = "" $n = 1 For $n = 1 To UBound($pass) - 1 $pass2 = $pass2 & Chr($pass[$n]) Next $n = 0 $f = 0 For $n = 0 To UBound($binary) - 2 $f = $n + 2 $binary = StringReplace($binary,$binary[$f],"",1) $n = $n + 1 Next $len = UBound($binary) For $n = 0 To $len - 1 $binary_encrypted = $binary_encrypted & Chr($binary[$n]) Next MsgBox(0,"",$binary_encrypted) ;FileWrite(@DesktopDir & "\log.etf",$binary_encrypted) MsgBox(0,"",$pass2) Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now