// HexRenban 2008.07.18 by あすかぜ // 16進数の連番を作成します。 // 編集・再配布は自由です。 // // 内部的に int で処理しているため、int におさまらない値は扱えません。 // 7桁までの16進数を指定してください。 // 16進→10進変換 function toDec(str){ length = len(str); result = 0; negative = false; for(i=1; i<=length; i++){ ch = mid(str, i, 1); if(ch == "0"){ result = result * 16 + 0; }else if(ch == "1"){ result = result * 16 + 1; }else if(ch == "2"){ result = result * 16 + 2; }else if(ch == "3"){ result = result * 16 + 3; }else if(ch == "4"){ result = result * 16 + 4; }else if(ch == "5"){ result = result * 16 + 5; }else if(ch == "6"){ result = result * 16 + 6; }else if(ch == "7"){ result = result * 16 + 7; }else if(ch == "8"){ result = result * 16 + 8; }else if(ch == "9"){ result = result * 16 + 9; }else if(ch == "A" || ch == "a"){ result = result * 16 + 10; }else if(ch == "B" || ch == "b"){ result = result * 16 + 11; }else if(ch == "C" || ch == "c"){ result = result * 16 + 12; }else if(ch == "D" || ch == "d"){ result = result * 16 + 13; }else if(ch == "E" || ch == "e"){ result = result * 16 + 14; }else if(ch == "F" || ch == "f"){ result = result * 16 + 15; }else if(ch == "-"){ negative = true; } } if(negative){ result = -1 * result; } return result; } // 10進→16進変換 function toHex(val){ result = ""; negative = false; if(int(val) == 0){ return "0"; }else if(val < 0){ val = -1 * val; negative = true; } while(val > 0){ x = (val % 16); if(x == 0){ result = "0" + result; }else if(x > 0 && x <= 9){ result = str(x) + result; }else if(x == 10){ result = "A" + result; }else if(x == 11){ result = "B" + result; }else if(x == 12){ result = "C" + result; }else if(x == 13){ result = "D" + result; }else if(x == 14){ result = "E" + result; }else if(x == 15){ result = "F" + result; } val = (val - x) / 16; } if(negative){ result = "-" + result; } return result; } // ここからメイン // 選択範囲を変数に持っておく L = SelLeft; T = SelTop; B = SelBottom; // 現在の選択範囲左上を初期値のデフォルト値とする。 start = toDec(InputBox("初期値を入力してください(16進)", [L,T])); // 現在の選択範囲 1 行目と 2 行目の差分を増分値のデフォルト値とする。 step = toDec([L,T+1]) - toDec([L,T]); if(step < 1){ step = 1; } step = int(InputBox("増分値を入力してください(10進)", step)); // 現在の選択範囲を維持した場合の一番下の値を停止値のデフォルト値とする。 end = start + (B-T) * step; end = toDec(InputBox("停止値を入力してください(16進)", toHex(end))); // ループをまわして連番を書き込む current = start; y = T; while(current <= end){ [L,y] = toHex(current); current = current + step; y++; }