2022/09/05

Hyper-Vの統合サービスでつまづいたメモ。

パソコン関係から離れていたのでひさびさの投稿(・・;

Windows11 Hyper-VにWindows7 32bit/64bitを作成

初めにゲストOSにWindows7 32bit版をインストールしてみたら問題なく作れたので、同じようにWindows7 64bit版もやっていったんですが、インストールされたドライバが全然異なり、32bit版の方は「Hyper-V xxx ドライバ」なんて専用のものが入っていたのですが、64bit版の方は汎用ドライバしか入ってなくて調べだした感じです。


統合サービス?

以前のHyper-Vでは管理メニューから「統合サービスのインストール」ってものがあったようで、これで各種ドライバが入ってくれた用なのですが、現在使用しているHyper-VではWindowsUpdateで自動的に入るっぽいです。

ですが64bit版の方ではインストールされなかった?未対応?そこまではわからなかったです。


ダウンロード

↓コレ入れるらしい、microsoft support

Hyper-V integration components update for Windows

ただcabファイルで普通には入れられないっぽい。WindowsServer触ってる人だったら余裕なのかも知れない(・・;


インストール

ここ参照

How to install integration services when the virtual machine is not running

インストールというよりはパッチを当てるって感じです。

1.チェックポイントを無効にしてゲストOS停止、しばらくすると差分ファイルがvhdxファイルに反映されて1つにまとまる

 以後PowerShellの作業

2.vhdxファイルをドライブに割り当てる

3.書き込み可能設定にする

4.ドライブに対してcabファイルを書き込む。


32bit版の物とは、若干動作が違うけどグラフィックドライバとマウスリリースキーを押さなくてよくなったのでストレスなく使えるようになりました。




2015/12/18

AutoTouchでクラスを書いてみた。

AutoTouch関連の記事はこちらから

http://memorosa.blogspot.jp/search/label/AutoTouch

クラスを作ってみた

JavaScriptに似た感じの書き方らしいです・・・

なんだかテーブルにファンクションつめ込んだり、こんなことできるの?と思うような書き方でした。

元のスクリプトよりも処理速度がかかってしまいましたが、LUA学習の一貫ということで・・・


クラス作成さんぷる

findColorsを設定すれば動作可能です。

   1:   
   2:  adaptOrientation(ORIENTATION_TYPE.PORTRAIT);
   3:   
   4:  -- ------------------------------------
   5:  -- 
   6:  -- ------------------------------------
   7:   
   8:  -- イベント
   9:  local SW_EVENT = false;
  10:   
  11:  -- 移動経路 circle, minicircle
  12:  local SW_ROUTE = "minicircle";
  13:   
  14:  -- スキルボタン
  15:  local LOC_SKILL = {90, 970}
  16:   
  17:  -- 回転ボタン
  18:  local LOC_ROTATION = {540,970}
  19:   
  20:  -- ツムのマス目設定
  21:  local TSUMUXMIN = 40;
  22:  local TSUMUXMAX = 580;
  23:  local TSUMUYMIN = 320;
  24:  local TSUMUYMAX = 800;
  25:  local TSUMUSTEP = 80;
  26:   
  27:  -- ------------------------------------
  28:  -- image tap:
  29:  -- ------------------------------------
  30:  function imagetap(result)
  31:      for i, v in pairs(result) do
  32:          tap(v[1], v[2]);
  33:          return true;
  34:      end
  35:      return false;
  36:  end
  37:   
  38:  -- ------------------------------------
  39:  -- image check:
  40:  -- ------------------------------------
  41:  function imagecheck(result)
  42:      for i, v in pairs(result) do
  43:          return true;
  44:      end
  45:      return false;
  46:  end
  47:   
  48:  -- ------------------------------------
  49:  -- skill_tap:
  50:  -- ------------------------------------
  51:  function skill_tap()
  52:      tap(LOC_SKILL[1], LOC_SKILL[2]);
  53:      usleep(16000)
  54:  end
  55:   
  56:  -- ------------------------------------
  57:  -- rotation_tap:
  58:  -- ------------------------------------
  59:  function rotation_tap()
  60:      tap(LOC_ROTATION[1], LOC_ROTATION[2]);
  61:      usleep(16000)
  62:  end
  63:   
  64:  -- ------------------------------------
  65:  -- tsumu class:
  66:  -- ------------------------------------
  67:  tsumu = {}
  68:  tsumu.new =     function(xfr, xto, yfr, yto, step)
  69:                      obj = {}
  70:                      obj.rows = {}
  71:                      obj.xfr = xfr;
  72:                      obj.xto = xto;
  73:                      obj.yfr = yfr;
  74:                      obj.yto = yto;
  75:                      obj.step = step;
  76:                      obj.rowcount = 0;
  77:                      obj.colcount = 0;
  78:   
  79:                      for y = obj.yfr, obj.yto, obj.step do
  80:                          local cols = {}
  81:                          for x = obj.xfr, obj.xto, obj.step do
  82:                              table.insert(cols, {x, y});
  83:                          end
  84:                          table.insert(obj.rows, cols);
  85:                      end
  86:   
  87:                      for y = obj.yfr, obj.yto, obj.step do
  88:                          obj.rowcount = obj.rowcount + 1;
  89:                      end
  90:   
  91:                      for x = obj.xfr, obj.xto, obj.step do
  92:                          obj.colcount = obj.colcount + 1;
  93:                      end
  94:   
  95:                      obj.row =     function(self)
  96:                                  return self.rowcount;
  97:                              end
  98:   
  99:                      obj.col =     function(self)
 100:                                  return self.colcount;
 101:                              end
 102:   
 103:                      return obj;
 104:   
 105:                  end
 106:   
 107:  -- ------------------------------------
 108:  -- route class:
 109:  -- ------------------------------------
 110:  route = {}
 111:  route.select =     function(self)
 112:                      local i = math.random(self.ts:row());
 113:                      local j = math.random(self.ts:col());
 114:                      self.row = i;
 115:                      self.col = j;
 116:                      self.target = {i, j}
 117:                  end
 118:   
 119:  route.up =    function(self)
 120:                  self.row = self.row - 1;
 121:                  if (self.row > 0) and (self.row <= self.ts:row()) and
 122:                      (self.col > 0) and (self.col <= self.ts:col()) then
 123:                      table.insert(self.route, self.ts.rows[self.row][self.col]);
 124:                  end
 125:              end
 126:   
 127:  route.right =    function(self)
 128:                      self.col = self.col + 1;
 129:                      if (self.row > 0) and (self.row <= self.ts:row()) and
 130:                          (self.col > 0) and (self.col <= self.ts:col()) then
 131:                          table.insert(self.route, self.ts.rows[self.row][self.col]);
 132:                      end
 133:                  end
 134:   
 135:  route.down =    function(self)
 136:                      self.row = self.row + 1;
 137:                      if (self.row > 0) and (self.row <= self.ts:row()) and
 138:                          (self.col > 0) and (self.col <= self.ts:col()) then
 139:                          table.insert(self.route, self.ts.rows[self.row][self.col]);
 140:                      end
 141:                  end
 142:   
 143:  route.left =    function(self)
 144:                      self.col = self.col - 1;
 145:                      if (self.row > 0) and (self.row <= self.ts:row()) and
 146:                          (self.col > 0) and (self.col <= self.ts:col()) then
 147:                          table.insert(self.route, self.ts.rows[self.row][self.col]);
 148:                      end
 149:                  end
 150:   
 151:  route.run =     function(self)
 152:                      local x = self.ts.rows[self.target[1]][self.target[2]][1];
 153:                      local y = self.ts.rows[self.target[1]][self.target[2]][2];
 154:                      local w = 10000;
 155:                      touchDown(0, x, y); usleep(w);
 156:                      for key, val in pairs(self.route) do
 157:                          x = val[1];
 158:                          y = val[2];
 159:                          touchMove(0, x, y); usleep(w);
 160:                      end
 161:                      touchUp(0, x, y); usleep(w);
 162:                  end
 163:   
 164:  -- ------------------------------------
 165:  -- create route class: circle
 166:  -- ------------------------------------
 167:  route_circle = {}
 168:  route_circle.new =     function(ts)
 169:                          obj = {}
 170:                          obj.route = {}
 171:                          obj.row = 0;
 172:                          obj.col = 0;
 173:                          obj.ts = ts;
 174:                          obj.target = {}
 175:                          setmetatable(obj, {__index=route})
 176:   
 177:                          obj:select();
 178:   
 179:                          -- 1周目
 180:                          obj:up();
 181:                          obj:right();
 182:                          obj:down();
 183:                          obj:down();
 184:                          obj:left();
 185:                          obj:left();
 186:                          obj:up();
 187:                          obj:up();
 188:   
 189:                          -- 2周目
 190:                          obj:up();
 191:                          obj:right();
 192:                          obj:right();
 193:                          obj:right();
 194:                          obj:down();
 195:                          obj:down();
 196:                          obj:down();
 197:                          obj:down();
 198:                          obj:left();
 199:                          obj:left();
 200:                          obj:left();
 201:                          obj:left();
 202:                          obj:up();
 203:                          obj:up();
 204:                          obj:up();
 205:                          obj:up();
 206:   
 207:                          -- 3周目
 208:                          obj:up();
 209:                          obj:right();
 210:                          obj:right();
 211:                          obj:right();
 212:                          obj:right();
 213:                          obj:right();
 214:                          obj:down();
 215:                          obj:down();
 216:                          obj:down();
 217:                          obj:down();
 218:                          obj:down();
 219:                          obj:down();
 220:                          obj:left();
 221:                          obj:left();
 222:                          obj:left();
 223:                          obj:left();
 224:                          obj:left();
 225:                          obj:left();
 226:                          obj:up();
 227:                          obj:up();
 228:                          obj:up();
 229:                          obj:up();
 230:                          obj:up();
 231:                          obj:up();
 232:   
 233:                          return obj;
 234:                      end
 235:   
 236:  -- ------------------------------------
 237:  -- create route class: circle
 238:  -- ------------------------------------
 239:  route_minicircle = {}
 240:  route_minicircle.new =     function(ts)
 241:                          obj = {}
 242:                          obj.route = {}
 243:                          obj.row = 0;
 244:                          obj.col = 0;
 245:                          obj.ts = ts;
 246:                          obj.target = {}
 247:                          setmetatable(obj, {__index=route})
 248:   
 249:                          obj:select();
 250:   
 251:                          -- 1周目
 252:                          obj:up();
 253:                          obj:right();
 254:                          obj:down();
 255:                          obj:down();
 256:                          obj:left();
 257:                          obj:left();
 258:                          obj:up();
 259:                          obj:up();
 260:   
 261:                          -- 2週目
 262:                          obj:up();
 263:                          obj:right();
 264:                          obj:right();
 265:                          obj:right();
 266:                          obj:down();
 267:                          obj:down();
 268:                          obj:down();
 269:                          obj:down();
 270:                          obj:left();
 271:                          obj:left();
 272:                          obj:left();
 273:                          obj:left();
 274:                          obj:up();
 275:                          obj:up();
 276:                          obj:up();
 277:                          obj:up();
 278:   
 279:                          return obj;
 280:                      end
 281:   
 282:  -- ------------------------------------
 283:  -- main
 284:  -- ------------------------------------
 285:  math.randomseed(os.time());
 286:   
 287:  local area_range = {}
 288:  local ts = tsumu.new(TSUMUXMIN, TSUMUXMAX, TSUMUYMIN, TSUMUYMAX, TSUMUSTEP);
 289:  local rt = {}
 290:   
 291:  while true do
 292:   
 293:      -- 「プレイ中」判別
 294:      area_range = {999, 999, 999, 999};
 295:      local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 296:      if imagecheck(result) then
 297:          if SW_ROUTE == "circle" then
 298:              rt = route_circle.new(ts);
 299:              rt:run();
 300:              skill_tap();
 301:          elseif SW_ROUTE == "minicircle" then
 302:              rt = route_minicircle.new(ts);
 303:              rt:run();
 304:              skill_tap();
 305:          end
 306:   
 307:      else
 308:          -- 「スタート」ボタン
 309:          area_range = {999, 999, 999, 999};
 310:          local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 311:          if imagecheck(result) then
 312:              usleep(5000000);
 313:              imagetap(result);
 314:              usleep(1000000);
 315:          end
 316:   
 317:          -- 「リトライ」ボタン
 318:          area_range = {999, 999, 999, 999};
 319:          local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 320:          if imagecheck(result) then
 321:              imagetap(result);
 322:              usleep(1000000);
 323:          end
 324:   
 325:          -- 「閉じる」ボタン
 326:          area_range = {999, 999, 999, 999};
 327:          local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 328:          if imagecheck(result) then
 329:              imagetap(result);
 330:              usleep(1000000);
 331:          end
 332:   
 333:          -- ハイスコア「閉じる」ボタン
 334:          area_range = {999, 999, 999, 999};
 335:          local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 336:          if imagecheck(result) then
 337:              imagetap(result);
 338:              usleep(1000000);
 339:          end
 340:   
 341:          -- 「続けてプレイしますか?」
 342:          area_range = {999, 999, 999, 999};
 343:          local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 344:          if imagecheck(result) then
 345:              -- 「キャンセル」
 346:              local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 347:              if imagecheck(result) then
 348:                  imagetap(result);
 349:                  usleep(1000000);
 350:              end
 351:          end
 352:   
 353:   
 354:   
 355:          if SW_EVENT then
 356:              -- 「あきらめる」ボタン
 357:              area_range = {999, 999, 999, 999};
 358:              local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 359:              if imagecheck(result) then
 360:                  imagetap(result);
 361:                  usleep(1000000);
 362:              end
 363:   
 364:              -- 「ダイスを振る」ボタン
 365:              area_range = {999, 999, 999, 999};
 366:              local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 367:              if imagecheck(result) then
 368:                  imagetap(result);
 369:                  usleep(1000000);
 370:              end
 371:   
 372:              -- 「閉じる」ボタン
 373:              area_range = {999, 999, 999, 999};
 374:              local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 375:              if imagecheck(result) then
 376:                  imagetap(result);
 377:                  usleep(1000000);
 378:              end
 379:   
 380:              -- ロゴ
 381:              area_range = {999, 999, 999, 999};
 382:              local result = findColors({{99999999,0,0}, {99999999,9,9}, {99999999,9,9}, {99999999,9,9}}, 0, area_range);
 383:              if imagecheck(result) then
 384:                  imagetap(result);
 385:                  usleep(1000000);
 386:              end
 387:   
 388:          end
 389:   
 390:      end
 391:   
 392:  end



2015/11/22

AutoTouchでツムツムを自動化してみた(オートプレイ) - Disney Tsum Tsum Auto Play

AutoTouch関連の記事はこちらから

http://memorosa.blogspot.jp/search/label/AutoTouch

ツムツム自動化

色検索にしてから、スクリプトの処理速度が上がったので、試しにツムツムを自動化してみたけど、

どうやってツムを認識するのか全くわからなかった。。。あとパズルに必要なロジックも知らない(。。;

なので適当にツム選択して、そして適当に動かしてみたらこんな感じになった。


スクリプトは。。。

公開していいものか、簡単に判断できなかったので、こんなことも可能という情報のみに。




2015/11/06

AutoTouchスクリプトを色検索に切り替え

AutoTouch関連の記事はこちらから

http://memorosa.blogspot.jp/search/label/AutoTouch

機能追加

AutoTouch v3.5.3になってから機能が大幅に追加されています。

主な機能がスクリプトしやすいようになったインターフェースと各ツールなど


画像検索が動かない・・・

バージョンアップする毎にfindimageの動作がよくわからない状態なので、今回追加された機能を利用して色検索に切り替えようと思います。


1.実行画面に出ている「スナップ」でスクリーンショットを撮る

2.スクリプト編集時に出ている「エクステンション」を使い

3.findcolorsの「ヘルパー」を使ってスナップで撮った画像を読み込み色を決める

4.あとは自分のスクリプトにコピペ


動作環境

4機種(3種類)手元にあって、動作は確認取れています。

(iPodTouch 5G, iPodTouch6G, iPhone5s, iOS 8.4, AutoTouch v3.5.3-7)


出来上がったものがこちら↓

スクリプトをシンプルにしたかったので、今まで同様1動作したら終了する感じです。

スクリプト終了させる命令がわからなかったので、while do内でbreakを使って処理を抜ける手法


何かのゲームのAutoスクリプト

   1:   
   2:  adaptOrientation(ORIENTATION_TYPE.PORTRAIT);
   3:   
   4:  -- ------------------------------------
   5:  -- image tap:
   6:  -- ------------------------------------
   7:  function imagetap(result)
   8:      for i, v in pairs(result) do
   9:          tap(v[1], v[2]);
  10:          return true;
  11:      end
  12:      return false;
  13:  end
  14:   
  15:  -- ------------------------------------
  16:  -- image check:
  17:  -- ------------------------------------
  18:  function imagecheck(result)
  19:      for i, v in pairs(result) do
  20:          return true;
  21:      end
  22:      return false;
  23:  end
  24:   
  25:  -- ------------------------------------
  26:  -- combo:
  27:  -- ------------------------------------
  28:  function lance3_combo13()
  29:      local x = 160; local y = 860;
  30:   
  31:      tap(x, y); usleep(0400000);
  32:   
  33:      tap(x, y); usleep(0300000);
  34:      tap(x, y); usleep(0300000);
  35:      tap(x, y); usleep(0400000);
  36:   
  37:      tap(x, y); usleep(0300000);
  38:      tap(x, y); usleep(0300000);
  39:      tap(x, y); usleep(0400000);
  40:   
  41:      tap(x, y); usleep(0300000);
  42:      tap(x, y); usleep(0300000);
  43:      tap(x, y); usleep(0400000);
  44:   
  45:      tap(x, y); usleep(0300000);
  46:      tap(x, y); usleep(0300000);
  47:      tap(x, y); usleep(0400000);
  48:   
  49:      tap(x, y); usleep(0300000);
  50:      tap(x, y); usleep(0300000);
  51:      tap(x, y); usleep(0400000);
  52:  end
  53:   
  54:  local sp_area = {6, 1060, 26, 18};
  55:   
  56:  -- ------------------------------------
  57:  -- main
  58:  -- ------------------------------------
  59:  while true do
  60:   
  61:      local result_sp_true  = findColors({{8138104,0,0}, {7086184,-1,10}, {8004726,20,0}, {10174357,13,10}}, 0, sp_area);
  62:      if imagecheck(result_sp_true) then
  63:          lance3_combo13();
  64:          break;
  65:      end
  66:   
  67:      local result_sp_false = findColors({{4069180,0,0}, {3543092,-1,10}, {5054282,13,10}, {4002363,20,0}}, 0, sp_area);
  68:      if imagecheck(result_sp_false) then
  69:          lance3_combo13();
  70:          break;
  71:      end
  72:   
  73:      local result_battle_end_ok = findColors({{16635378,0,0}, {14550936,57,0}, {14616730,54,29}, {14945441,-4,29}}, 0, nil);
  74:      if imagecheck(result_battle_end_ok) then
  75:          imagetap(result_battle_end_ok);
  76:          usleep(1000000);
  77:          break;
  78:      end
  79:   
  80:      local result_battle_retry = findColors({{16564715,0,0}, {15405481,-2,29}, {15826381,131,2}, {14555038,128,31}}, 0, nil);
  81:      if imagecheck(result_battle_retry) then
  82:          imagetap(result_battle_retry);
  83:          usleep(1000000);
  84:          break;
  85:      end
  86:   
  87:      local result_battle_retry_start = findColors({{16686829,0,0}, {10028154,-4,38}, {16469979,88,-1}, {7340366,90,37}}, 0, nil);
  88:      if imagecheck(result_battle_retry_start) then
  89:          imagetap(result_battle_retry_start);
  90:          usleep(1000000);
  91:          break;
  92:      end
  93:   
  94:  end



2015/04/10

AutoTouch findimage error 3.1.1 , 3.1.2

AutoTouch関連の記事はこちらから

http://memorosa.blogspot.jp/search/label/AutoTouch

構文やら色々変更っぽい

AutoTouchを3.0.1から3.1.x(3.1.1と3.1.2)にアップデートしたらスクリプトが動かなくなったので調べてみた。

AutoTouchを起動して「Setting」→「Help」を覗いてみると、文法の書き方やサンプルも出るのでfindimageの使い方を見てみると下記のように変わっていた。


追記 エラー内容:bad argument #-5 to 'findImage' (string expected, got nil)


findImage

   1:  findImage(imagePath, count, fuzzy, ignoreColors, region)

パラメータが1つ増えて範囲指定ができるっぽいのと、括弧の付け方も違う、あとは値の省略ができないっぽい感じ

設定しないパラメータには「nil」を設定するといいみたい。。。たぶん。。。


使い方、チェック方法はなんとか分かった感じだと思う。あとは範囲も調べて設定できたら処理速度が早くなるんだろうと・・・

とりあえず確認用スクリプト


findImage Test Script

   1:  local r = findImage("test.png", 1, 1, nil, nil);
   2:   
   3:  if r == nil then
   4:      alert("nil");
   5:  else
   6:      local n = 0;
   7:      for i, v in pairs(r) do
   8:          n = n + 1;
   9:      end
  10:   
  11:      if n == 0 then
  12:          alert("false");
  13:      else
  14:          alert("true");
  15:      end
  16:  end