TheBlindHouse

EXE Press

Apr 30th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. title EXE Press
  2. #added to allow for Run Script from within editor.
  3. if %1
  4. if @equal(@ext(%1),sns)
  5. shift
  6. end
  7. end
  8. ##################################################
  9. if @not(@file(@path(%0)upx.exe))
  10. warn upx.exe not found.
  11. stop
  12. end
  13.  
  14. %%ver = 2.0.0.0
  15. option fieldsep,"."
  16. dialog CREATE,EXE Press v%%ver,-1,0,443,284,CLASS actpak,DRAGDROP,color white
  17. rem *** Modified by Dialog Designer on 5/6/2008 - 13:45 ***
  18. dialog ADD,EXTTEXT,EXTTEXT1,2,7,168,17,Browse for file or <b>drag -n- drop</b>
  19. dialog ADD,EDIT,EDIT1,19,9,352,19
  20. dialog ADD,BUTTON,Browse,16,366,64,24,Browse
  21. dialog ADD,GROUP,GROUP1,99,10,427,177,Output
  22. #dialog ADD,EDIT,out,120,18,394,147,,,MULTI,WRAP,SCROLL,readonly
  23. dialog ADD,TEXT,out,120,18,409,147
  24. dialog ADD,TRACKBAR,Level,44,143,136,26,1|9|1,5,,LEFT
  25. dialog ADD,TEXT,TEXT2,53,12,,,Compression Level: MIN
  26. dialog ADD,BUTTON,compress,50,303,60,24,Compress
  27. dialog ADD,BUTTON,decompress,50,366,72,24,DeCompress
  28. dialog ADD,CHECK,bak,77,13,119,18,Create Backup File
  29. dialog ADD,TEXT,MAX,55,278,,,MAX
  30. #if %%exe
  31. # DIALOG ADD,BUTTON,cmu,79,199,158,24,Remove from EXE context menu
  32. #else
  33. # DIALOG ADD,BUTTON,cmu,79,199,148,24,Add to EXE context menu
  34. #end
  35. dialog SHOW
  36.  
  37. if %1
  38. dialog set,Edit1,%1
  39. dialog set,level,9
  40. goto CompressButton
  41. end
  42. if @winexists(#TMainWin)
  43. %t = @wintext(#TMainWin)
  44. %p = @pos(":",%t)
  45. %%proj = @trim(@substr(%t,@pred(%p),@len(%t)))
  46. %p = @path(%%Proj)
  47. %%in = %p@name(%%Proj)".exe"
  48. dialog set,edit1,%%in
  49. dialog set,level,9
  50. end
  51.  
  52. :evloop
  53. wait event
  54. goto @event()
  55.  
  56. :cmubutton
  57. %%exe = @regread(ROOT,.exe\shell\Compress,command)
  58. if %%exe
  59. registry write,ROOT,.exe\shell\Compress,command
  60. %%exe =
  61. else
  62. registry write,ROOT,.exe\shell\Compress,command,%0
  63. %%exe = %0
  64. end
  65. if %%exe
  66. dialog set,cmu,Remove from EXE context menu
  67. else
  68. dialog set,cmu,Add to EXE context menu
  69. end
  70.  
  71. goto evloop
  72.  
  73. :DragDrop
  74. list create,1
  75. %l = 1
  76. list dropfiles,%l
  77. if @equal(@ext(@item(%l)),EXE)
  78. dialog set,edit1,@item(%l)
  79. end
  80. list close,1
  81. goto evloop
  82.  
  83. :BrowseButton
  84. %f = @filedlg(*.exe)
  85. if @ok()
  86. dialog set,edit1,%f
  87. end
  88. goto evloop
  89.  
  90. :close
  91. #file delete,@path(%0)upx.exe
  92. stop
  93.  
  94. :CompressButton
  95. dialog set,out,"Working, Please wait..."
  96. %l = @dlgtext(level)
  97. if @dlgtext(bak)
  98. %b = -k
  99. end
  100. runh @path(%0)\upx.exe -%l %b @chr(34)@dlgtext(edit1)@chr(34),pipe
  101. list create,1
  102. %t = 1
  103. list assign,%t,@pipe()
  104. list seek,%t,0
  105. %x = 0
  106. repeat
  107. list delete,%t
  108. %x = @succ(%x)
  109. until @equal(%x,4)
  110. list insert,%t
  111. #dialog set,out,@pipe()
  112. dialog set,out,@text(%t)
  113. list close,%t
  114. goto evloop
  115.  
  116. :Compress
  117. dialog set,out,"Working, Please wait..."
  118. %l = @dlgtext(level)
  119. if @dlgtext(bak)
  120. %b = -k
  121. end
  122. runh @path(%0)\upx.exe -%l %b @chr(34)@dlgtext(edit1)@chr(34),pipe
  123. list create,1
  124. list assign,%t,@pipe()
  125. list seek,%t,0
  126. %x = 0
  127. repeat
  128. list delete,%t
  129. %x = @succ(%x)
  130. until @equal(%x,4)
  131. list insert,%t
  132. #dialog set,out,@pipe()
  133. dialog set,out,@text(%t)
  134. list close,%t
  135. stop
  136.  
  137. :DecompressButton
  138. dialog set,out,"Working, Please wait..."
  139. runh @path(%0)\upx.exe -d @chr(34)@dlgtext(edit1)@chr(34),pipe
  140. list create,1
  141. %t = 1
  142. list assign,%t,@pipe()
  143. list seek,%t,0
  144. %x = 0
  145. repeat
  146. list delete,%t
  147. %x = @succ(%x)
  148. until @equal(%x,4)
  149. list insert,%t
  150. #dialog set,out,@pipe()
  151. dialog set,out,@text(%t)
  152. list close,%t
  153. goto evloop
Advertisement
Add Comment
Please, Sign In to add comment