HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2013
0124
ワイルド中学生自動カーソル移動、自動クリック2解決


ワイルド中学生

リンク

2013/1/24(Thu) 22:52:57|NO.52023

とあるサイトの自動ダウンロードスクリプト(超簡単なやつ)を作りました。
マウスカーソル移動を移動させて、コピー貼り付けして名前をつけて保存をする動作です。

たまにOSのダイアログなどが出て動作がズレてしまうことがあるので
一定の時間、「名前をつけて保存」や「ブラウザの戻る」、「リンクのクリック」「」のいずれかがが一定時間内に起こらなかったときスクリプトを停止させるのを組み込みたいのですが
それらが起こるか起こらないという判定はできますか?
Internet Explorer 9を使っています
osはwindows 7です

一応書いておきます

#uselib "user32.dll" #func mouse_event "mouse_event" int, int, int #func keybd_event "keybd_event" int, int, int ;escで終了 wait 500 repeat -1 stick a,0,0 mouse 35,52 mouse_event $2|$4 ;左クリック if a&128 : stop wait 500 keybd_event 9,-1;TABキー入力 wait 2 keybd_event 13,-1;enterキー入力 mouse 613,203 if a&128 : stop wait 500 mouse_event $2;ドラッグ開始 mouse 163,203 wait 2 mouse_event $4;ドラッグ終了 wait 2 mouse_event $8|$10;右クリック mouse 255,249 wait 2 mouse_event $2|$4;左クリック mouse 393,416 wait 2 mouse_event $2|$4;左クリック mouse 646,1041 if a&128 : stop wait 1000 mouse_event $2|$4;左クリック mouse 698,1022 wait 2 mouse_event $2|$4;左クリック mouse 192,459 wait 100 mouse_event $8|$10;右クリック mouse 286,552 wait 2 mouse_event $2|$4;左クリック mouse 760,550 wait 2 mouse_event $2|$4;左クリック if a&128 : stop wait 1000 loop



この記事に返信する


いひ

リンク

2013/1/25(Fri) 18:05:01|NO.52029

以前投稿したスクリプトですがもう一度

sendinput 関数を使用すれば 他のウィンドウやアプリケーションにカーソルを盗まれなくて済みます。



#include "user32.as" #define global ctype MOUSE_EVENT_X(%1=0) ((%1)*0xFFFF/ginfo_dispx) #define global ctype MOUSE_EVENT_Y(%1=0) ((%1)*0xFFFF/ginfo_dispy) #define INPUT_MOUSE $00000000 #define MOUSEEVENTF_MOVE $00000001 #define MOUSEEVENTF_LEFTDOWN $00000002 #define MOUSEEVENTF_ABSOLUTE $00008000 #define MOUSEEVENTF_LEFTUP $00000004 #const global INPUT_STRUCTSIZE 28 #const global INPUT_ELETOAL INPUT_STRUCTSIZE/4 onexit *exit_ // 電卓を開く exec "calc.exe" // 電卓がアクティブに成るまで検索し続ける。 repeat GetForegroundWindow:hwnd_target=stat sdim cn,0xFF:GetClassName hwnd_target,varptr(cn),0xFF:cn=getpath(cn,16) sdim wt,0xFF:GetWindowText hwnd_target,varptr(wt),0xFF if(instr(cn,0,"calc")!=-1) or (instr(wt,0,"電卓")!=-1):break await 30 loop // インターフェイスの作成 txt_input =strf("ターゲット %d : タイトル %s : クラス %s",hwnd_target , wt , cn) objsize ginfo_winx,20 mesbox txt_input ,,,0 button gosub "111111111111111*5",*calc1 button gosub "123456+654321",*calc2 topy = ginfo_cy stop *initcalc mx = ginfo_mx:my = ginfo_my color 255,255,255:boxf:color:pos 0,topy SetWindowPos hwnd_target,-1,0,0,0,0,0x43 // 最前面表示 init_iptstruct:calcbttpush "CE" return *exitcalc app_iptstruct MOUSE_EVENT_X(mx) , MOUSE_EVENT_Y(my) , MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE sendinput stat , varptr(inpt) , INPUT_STRUCTSIZE SetWindowPos hwnd_target,-2,0,0,0,0,0x3 // 最前面表示を解除 return *calc1 gosub *initcalc repeat 15 calcbttpush "1" loop calcbttpush "*" calcbttpush "5" calcbttpush "=" gosub *exitcalc return *calc2 gosub *initcalc enum 1,7,1 calcbttpush "+" enum 6,0,-1 calcbttpush "=" gosub *exitcalc return #deffunc enum int a_ , int b_ , int add_ ,local i_ for i_,a_,b_,add_:calcbttpush ""+i_:next:return *exit_ gsel 0,-1 IsWindow hwnd_target if(stat!=0){ dim tbi,35:tbi=140 // タイトルバーインフォ構造体を初期化 gosub *initcalc sendmsg hwnd_target,0x033F,,varptr(tbi) // 電卓の終了ボタンの位置を取得 app_iptstruct_lpushup MOUSE_EVENT_X(tbi(31)+1),MOUSE_EVENT_Y(tbi(31+1)+1) gosub *exitcalc } end return #deffunc calcbttpush str wt_ , local rt_ findwindowex hwnd_target , 0 , "button" , wt_:hwnd_btt = stat if(hwnd_btt){ dim rc,4:GetWindowRect hwnd_btt , varptr(rc) app_iptstruct_lpushup MOUSE_EVENT_X(rc(0)+1) , MOUSE_EVENT_Y(rc(1)+1) } mes strf("入力予約 %s 有効 %d",wt_,hwnd_btt!=0) return idx/INPUT_ELETOAL #deffunc app_iptstruct_lpushup int px_ , int py_ app_iptstruct px_ , py_ , MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE app_iptstruct 0,0 , MOUSEEVENTF_LEFTDOWN:app_iptstruct 0,0 , MOUSEEVENTF_LEFTUP return stat #deffunc app_iptstruct int px_,int py_ , int flg_ inpt.idx = INPUT_MOUSE , px_ , py_ , 0 , flg_ , 0 , 0 idx+=INPUT_ELETOAL:return idx/INPUT_ELETOAL #deffunc init_iptstruct dim inpt:dim idx:return



ワイルド中学生

リンク

2013/1/25(Fri) 21:01:10|NO.52030

ありがとうございます。試してみます<(_ _)>



ONION software Copyright 1997-2023(c) All rights reserved.