D-Bug & Automation Forum | |
D-Bug & Automation Forum >> Coding >> Quick Extract 0.4 source code.
http://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1269690191 Message started by Christos on 27.03.10 at 11:43:10 |
Title: Re: Quick Extract 0.5 source code. Post by ggn on 14.03.12 at 20:03:56
WTFPL \o/
In a more serious note, I had a quick glance over the source code and would like to make a few suggestions. They are more or less of aesthetic purposes, but maybe they will help Christos (or anyone else) in bigger projects. (hope they won't come out as too pretentious ;)) Code (]~SHEL_READ(cmd$,tail_str$) tail$=RIGHT$(tail_str$,(LEN(tail_str$)-1))[/code):
There, this must have saved at most 128 bytes of RAM :). Next up: Code (]IF ext$="zip" OR ext$="ZIP" @unzip ENDIF IF ext$="rar" OR ext$="RAR" @unrar ENDIF IF ext$="lzh" OR ext$="LZH" OR ext$="lha" OR ext$="LHA" @unlzh ENDIF IF ext$="zoo" OR ext$="ZOO" @unzoo ENDIF IF ext$="tar" OR ext$="TAR" @untar ENDIF ... etc [/code):
Finally you could also replace all ifs with select/case: Code (]select upper$(ext$) case "ZIP" @unzip case "RAR" @unrar case "LZH" @unlzh case"LHA" @unlzh case "ZOO" @unzoo case "TAR" @untar .... endselect[/code):
All those years I used the ~exec(...) syntax, i.e. discarding the program's exit code. You could use this to your advantage here: Code (]return&=EXEC(0,progdir$+"arc\unzip.ttp",CHR$(LEN(cmdl2$))+cmdl2$,"") if return&=0 'program exited successfully else 'oops, something bad happened endif[/code):
Anyway, that's my xunty suggestions regarding the code. About program functionality now... How about if the program scanned (for example) for control pressed at startup and if that's true then extract the contents of the archive in a new folder and if (again for example) alt was pressed then it'd extract the contents in a new folder? That would (imho) reward frequent users with a more usable program, since they won't have to move the mouse to select an option they know by heart. |
D-Bug & Automation Forum » Powered by YaBB 2.6.0! YaBB Forum Software © 2000-2024. All Rights Reserved. |