Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias resolutions {
- if (!$3) { echo 4 -tg Invalid arguments! /resolutions STEPS WIDTH_RATIO HEIGHT_RATIO [STARTING_RESOLUTION] | echo 4 -tg EX: /resolutions 5 16 9 1024 | halt }
- var %steps $1
- var %WIDTH_RATIO $2
- var %HEIGHT_RATIO $3
- var %width $iif($4, $v1 - %WIDTH_RATIO, 0)
- if (!$window(@Resolutions)) {
- ; Tabs: Num, Resolution, Pixels
- window -e -t10,30,70 @Resolutions
- }
- if ($line(@Resolutions, 0) > 0) {
- echo -g @Resolutions $chr(160)
- }
- else {
- aline @Resolutions $+(ID,$chr(9),Resolution,$chr(9),Pixels)
- }
- ;echo -g @Resolutions Listing %steps resolutions for $+(%WIDTH_RATIO,:,%HEIGHT_RATIO) $iif(%width > 0,starting at $calc(%width + %WIDTH_RATIO),)
- var %lastheight = 0
- var %stepnum = 1
- var %height 0
- while (%stepnum <= %steps) {
- inc %width %WIDTH_RATIO
- %height = $calc(%width / %WIDTH_RATIO * %HEIGHT_RATIO)
- if (%lastheight != %height) {
- aline @Resolutions $+(%stepnum,$chr(9),%width $+ x $+ %height,$chr(9),$bytes($calc(%width * %height),b))
- %lastheight = %height
- inc %stepnum
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment