LoginSignup
0
3

More than 5 years have passed since last update.

uwscでサクッとプログラム

Last updated at Posted at 2018-05-16

uwscを使うと直感的にwindowsを操作できて便利。
例えば、僕は F1 キーを押すと chrome の一番左のタブを 更新する。
というショートカットを作り使っています。

・マウス座標の位置を計測
https://www.vector.co.jp/download/file/winnt/util/fh677994.html

sckeyの仮想キー一覧
http://canal22.org/vkey/

今回は、サクッと作るために簡単なプログラムをまとめます。

chrome が立ち上がっていない状態で、 chorme を立ち上げる


exec("cmd /c start=http://yahoo.co.jp")

chrome にキーを送る



//現在開いているchrome を選択、アクティブに。
id = GETID("Google Chrome","Chrome_WidgetWin_1",-1)

//ショートカットキーを送り 一番左のタブを選択
sckey(id, VK_CTRL,1) // shift + tab

//F5キーで更新
SCKEY(id,VK_F5)


待機


sleep(1)

立ち上がっていない chrome を起動。yahooを一瞬開いた後、googleに移動


//chromeを起動。yahooを開く
exec("cmd /c start=http://yahoo.co.jp")
id = GETID("Google Chrome","Chrome_WidgetWin_1",-1)


//URL入力欄へカーソルを移動
sckey(id, vk_alt,vk_d)

//URLを削除
sckey(id, vk_delete)

//googleへの移動文字列を入力
sendstr(id,"http://google.co.jp")

//enterを送信し、移動
sckey(id, vk_enter)


繰り返し

マウス座標 -777 から 横に 3回、 170ずつ座標をずらす


i = 0;
x = -777

while true

    mmv(x, 455)
    sleep(1)
    //btn(left,click)

    x = x+170

    ifb i = 3 then
            break
        endif

i = i+1

wend

ランダムでスリープ



//指定した秒数までランダムでスリープ
//最低でも0.5秒はスリープ
//randSleep(5)
function randSleep(max_rand)
    rand = random(max_rand)

ifb rand < 1 then
        rand = 0.5
    endif

    sleep(rand)
    result = true
fend

指定した画像をクリック


ifb CHKIMG( "dlbtn.bmp") //画像はbmpで。パスはuwscファイルの場所から。
x=G_IMG_X // 画像の座標をxへ代入
y=G_IMG_Y // 画像の座標をyへ代入
BTN(LEFT, CLICK, x+2, y+2, 80)// 画像の場所を左クリック
else 
PRINT "画像を探しても見つかりませんでした。"
endif

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3