{"id":3477,"date":"2019-04-13T06:57:52","date_gmt":"2019-04-12T21:57:52","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=3477"},"modified":"2019-04-13T06:57:52","modified_gmt":"2019-04-12T21:57:52","slug":"xdotool-%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e5%85%a8%ef%bc%92%ef%bc%96%e5%ae%9f%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=3477","title":{"rendered":"xdotool \u30b3\u30de\u30f3\u30c9\u5168\uff12\uff16\u5b9f\u4f8b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u3068\u3053\u308dPHP\u3084JavaScript\u306e\u8a18\u4e8b\u3070\u304b\u308a\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u305f\u307e\u306b\u306f\u3082\u3063\u3068\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u74b0\u5883\u306e\u3082\u306e\u3082\u3084\u3063\u3066\u307f\u3088\u3046\u3068\u3044\u3046\u6c17\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3067\u304d\u308b\u306a\u3089\u81ea\u5206\u306e\u958b\u767a\u74b0\u5883\u306b\u30d7\u30e9\u30b9\u306b\u306a\u308b\u3082\u306e\u3092\u77e5\u8b58\u3068\u3057\u3066\u4ed5\u5165\u308c\u3066\u304a\u304d\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u4eca\u56de\u306f\u524d\u3005\u304b\u3089\u6c17\u306b\u306a\u3063\u3066\u3044\u305f\u3001<\/p>\n<p><strong style=\"font-size: 25px;\">xdotool\uff08\u3048\u3063\u304f\u3059\u30fb\u3069\u3045\u30fb\u3064\u30fc\u308b\uff09<\/strong><\/p>\n<p>\u306e\u5168\u30b3\u30de\u30f3\u30c9\u30fb\u307e\u3068\u3081\u3092\u304a\u5c4a\u3051\u3057\u307e\u3059\u3002<\/p>\n<p><code>xdotool<\/code> \u3068\u3044\u3046\u306e\u306f\u3001\u30b3\u30de\u30f3\u30c9\u304b\u3089\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3001\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u64cd\u4f5c\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ol>\n<li>Google Chrome\u3067\u65b0\u3057\u3044\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u958b\u304f<\/li>\n<li>\u30a2\u30c9\u30ec\u30b9\u30d0\u30fc\u306b\u79fb\u52d5\u3059\u308b<\/li>\n<li>http:\/\/yahoo.co.jp\u3068\u30bf\u30a4\u30d7\u3059\u308b<\/li>\n<li>\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3092\u62bc\u3057\u3066\u30e4\u30d5\u30fc\u3092\u8868\u793a\u3059\u308b<\/li>\n<\/ol>\n<p>\u3055\u3089\u306b\u3001\u3053\u306e\u305d\u308c\u305e\u308c\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u66f8\u3044\u3066\u304a\u3051\u3070\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\uff11\u301c\uff14\u307e\u3067\u306e\u52d5\u304d\u3092\u5168\u81ea\u52d5\u3067\u5b9f\u884c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\uff01<\/p>\n<p>\u203b xdotool\u306f\u57fa\u672c\u7684\u306bLinux\u3084OSX\u5411\u3051\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002Windows\u5411\u3051\u3082\u3042\u308b\u306b\u306f\u3042\u308b\u3088\u3046\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3042\u3057\u304b\u3089\u305am _ _m<\/p>\n<p>\u3067\u306f\u3001\u3072\u3068\u3064\u305a\u3064\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-418 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35.png\" alt=\"\" width=\"370\" height=\"240\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/35-300x195.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300cxdotool\u3067\u3044\u308d\u3044\u308d\u81ea\u52d5\u5316\u3067\u304d\u305d\u3046\uff01\u300d<\/p>\n<p>\u5b9f\u884c\u74b0\u5883\uff1a Ubuntu 18.04, xdotool 3.20160805.1<\/p>\n<h1>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h1>\n<p>\u516c\u5f0f\u30da\u30fc\u30b8\u306b\u3088\u308b\u3068\u3001\u5404\u7a2e\u30d1\u30c3\u30b1\u30fc\u30b8\u30fb\u30de\u30cd\u30fc\u30b8\u30e3\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002\uff08\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f<code>sudo<\/code>\u306a\u3069\u6a29\u9650\u304c\u5fc5\u8981\u306b\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n<h2>Debian (Ubuntu)<\/h2>\n<pre><strong>apt-get install xdotool<\/strong><\/pre>\n<h2>FreeBSD<\/h2>\n<pre><strong>pkg install xdotool<\/strong><\/pre>\n<h2>Fedora<\/h2>\n<pre><strong>dnf install xdotool<\/strong><\/pre>\n<h2>OSX<\/h2>\n<pre><strong>brew install xdotool<\/strong><\/pre>\n<h2>OpenSUSE<\/h2>\n<pre><strong>zypper install xdotool<\/strong><\/pre>\n<h1>xdotool\u30b3\u30de\u30f3\u30c9<\/h1>\n<h2>\u30ad\u30fc\u30dc\u30fc\u30c9\u95a2\u9023<\/h2>\n<h3 id=\"xdotool_key\">key\u3067\u30ad\u30fc\u5165\u529b\u3059\u308b<\/h3>\n<p>\u4e00\u756a\u57fa\u672c\u7684\u306b\u306a\u30b3\u30de\u30f3\u30c9\u3067\u3001\u64ec\u4f3c\u7684\u306b\u30ad\u30fc\u30dc\u30fc\u30c9\u306e\u30ad\u30fc\u3092\u30bf\u30a4\u30d7\u3057\u305f\u52d5\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u300ca\u300d\u3092\u5165\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool key a<\/strong><\/pre>\n<p><code>shitf<\/code>\u3084<code>ctrl<\/code>\u306a\u3069\u3068\u9023\u643a\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>+<\/code>\u3067\u6587\u5b57\u3092\u3064\u306a\u304e\u307e\u3059\u3002<\/p>\n<pre># shift\u30ad\u30fc\u3068\u9023\u643a\r\n<strong>xdotool key shift+a<\/strong><\/pre>\n<pre># ctrl\u30ad\u30fc\u3068\u9023\u643a\r\n<strong>xdotool key ctrl+a<\/strong><\/pre>\n<pre># alt\u30ad\u30fc\u3068\u9023\u643a\r\n<strong>xdotool key alt+a<\/strong><\/pre>\n<p>\u307e\u305f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u8907\u6570\u306e\u9023\u643a\u30ad\u30fc\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre># shift, ctrl \u3068\u9023\u643a\r\n<strong>xdotool key shift+ctrl+w<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u7279\u6b8a\u306a\u30ad\u30fc\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\uff08\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u306f\u533a\u5225\u3055\u308c\u307e\u3059\u306e\u3067\u6b63\u78ba\u306b\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<pre># \u30b9\u30da\u30fc\u30b9\u30ad\u30fc\r\n<strong>xdotool key space<\/strong><\/pre>\n<pre># \u30d0\u30c3\u30af\u30b9\u30da\u30fc\u30b9\r\n<strong>xdotool key BackSpace<\/strong><\/pre>\n<pre># Del\u30ad\u30fc\r\n<strong>xdotool key Delete<\/strong><\/pre>\n<pre># Enter\u30ad\u30fc\uff08\"Enter\"\u3067\u306f\u306a\u3044\uff09\r\n<strong>xdotool key Return<\/strong><\/pre>\n<pre># \u30bf\u30d6\u30ad\u30fc\r\n<strong>xdotool key Tab<\/strong><\/pre>\n<pre># \u6570\u5b57\u30ad\u30fc<strong>\r\nxdotool key 1\r\nxdotool key 2\r\nxdotool key 3\r\n<\/strong>\uff08\u7d9a\u304f...\uff09<\/pre>\n<pre># \u65b9\u5411\u30ad\u30fc\r\n<strong>xdotool key Up<\/strong>\r\n<strong>xdotool key Down<\/strong>\r\n<strong>xdotool key Right<\/strong>\r\n<strong>xdotool key Left<\/strong><\/pre>\n<pre># Home\u30ad\u30fc\r\n<strong>xdotool key Home<\/strong><\/pre>\n<pre># End\u30ad\u30fc\r\n<strong>xdotool key End<\/strong><\/pre>\n<pre># F1\u30ad\u30fc\r\n<strong>xdotool key F1<\/strong><\/pre>\n<pre># Insert\u30ad\u30fc<strong>\r\nxdotool key Insert<\/strong><\/pre>\n<pre># PgUp, PgDn\u30ad\u30fc\r\n<strong>xdotool key Page_Up<\/strong>\r\n<strong>xdotool key Page_Down<\/strong><\/pre>\n<pre># PrntScr\r\n<strong>xdotool key Print<\/strong><\/pre>\n<pre># Windows\u30ad\u30fc<strong>\r\nxdotool key Super_L<\/strong><\/pre>\n<pre># Caps Lock\u30ad\u30fc<strong>\r\nxdotool key Caps_Lock<\/strong><\/pre>\n<pre># Numb Lock\u30ad\u30fc<strong>\r\nxdotool key Num_Lock\r\n<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u300cHello!\u300d\u306a\u3069\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u6b21\u306e<a href=\"#xdotool_type\">type<\/a>\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3046\u3068\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<h3 id=\"xdotool_type\">type \u3067\u30c6\u30ad\u30b9\u30c8\u5165\u529b\u3059\u308b<\/h3>\n<p>\u7279\u5b9a\u306e\u6587\u5b57\u5217\u3092\u5165\u529b\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u3046\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d6\u30e9\u30a6\u30b6\u306e\u30a2\u30c9\u30ec\u30b9\u30d0\u30fc\u306bURL\u3092\u6253\u3061\u8fbc\u3080\u5834\u5408\u306a\u3069\u306b\u4fbf\u5229\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>xdotool type https:\/\/yahoo.co.jp<\/strong><\/pre>\n<h3>keyup, keydown \u3067\u30ad\u30fc\u64cd\u4f5c\u3059\u308b<\/h3>\n<p><a href=\"#xdotool_key\">key<\/a>\u3068\u307b\u3068\u3093\u3069\u540c\u3058\u3067\u3059\u304c\u3001<code>keydown<\/code>\u306f\u30ad\u30fc\u3092\u62bc\u3057\u305f\u6642\u3060\u3051\u30a4\u30d9\u30f3\u30c8\u3092\u5b9f\u884c\u3057\u3001<code>keyup<\/code>\u306f\u305d\u306e\u9006\u3067\u3059\u3002<\/p>\n<h2>\u30de\u30a6\u30b9\u95a2\u9023<\/h2>\n<h3>mousemove \u3067\u30de\u30a6\u30b9\u3092\u79fb\u52d5\u3055\u305b\u308b<\/h3>\n<p>\u30de\u30a6\u30b9\u306e\u30ab\u30fc\u30bd\u30eb\u3092\u6307\u5b9a\u3057\u305f\u5ea7\u6a19\uff08x, y\uff09\u306b\u79fb\u52d5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool mousemove 100 200<\/strong><\/pre>\n<h3>mousemove_relative \u3067\u30de\u30a6\u30b9\u3092\u76f8\u5bfe\u7684\u306b\u79fb\u52d5\u3055\u305b\u308b<\/h3>\n<p>\u76f8\u5bfe\u7684\u306b\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u3092\u79fb\u52d5\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u30ab\u30fc\u30bd\u30eb\u304c\u73fe\u5728 <code>x,y = (100, 200)<\/code> \u306e\u5ea7\u6a19\u306b\u3042\u308b\u3068\u304d\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068<code>(130, 240)<\/code>\u3078\u79fb\u52d5\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool mousemove_relative 30 40<\/strong><\/pre>\n<h2 id=\"xdotool_click\">click \u3067\u30af\u30ea\u30c3\u30af\u3059\u308b<\/h2>\n<p>\u6587\u5b57\u901a\u308a\u30af\u30ea\u30c3\u30af\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u306a\u304a\u3001\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u6570\u5b57\u3067\u30de\u30a6\u30b9\u306e\u3069\u306e\u30dc\u30bf\u30f3\u3092\u4f7f\u3046\u304b\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<p>\uff11\u3000\u30fb\u30fb\u30fb\u3000\u5de6\u30dc\u30bf\u30f3<br \/>\n\uff12\u3000\u30fb\u30fb\u30fb\u3000\u4e2d\u30dc\u30bf\u30f3<br \/>\n\uff13\u3000\u30fb\u30fb\u30fb\u3000\u53f3\u30dc\u30bf\u30f3<br \/>\n\uff14\u3000\u30fb\u30fb\u30fb\u3000\u30de\u30a6\u30b9\u30db\u30a4\u30fc\u30eb\u3092\u4e0a\u3078<br \/>\n\uff15\u3000\u30fb\u30fb\u30fb\u3000\u30de\u30a6\u30b9\u30db\u30a4\u30fc\u30eb\u3092\u4e0b\u3078<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u73fe\u5728\u30ab\u30fc\u30bd\u30eb\u304c\u3042\u308b\u4f4d\u7f6e\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre># \u5de6\u30af\u30ea\u30c3\u30af\r\n<strong>xdotool click 1<\/strong><\/pre>\n<h2 id=\"xdotool_click\">click &#8211;repeat \u3067\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3059\u308b<\/h2>\n<p>\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u305f\u3044\u5834\u5408\u306f\u3001<a href=\"#xdotool_click\">click<\/a>\u30b3\u30de\u30f3\u30c9\u306b<code>--repeat<\/code>\u3092\u3064\u3051\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>xdotool click <strong>--repeat 2<\/strong> 1<\/pre>\n<h3>mouseup, mousedown \u3067\u30de\u30a6\u30b9\u3092\u64cd\u4f5c\u3059\u308b<\/h3>\n<p><a href=\"#xdotool_click\">click<\/a>\u3068\u307b\u307c\u540c\u3058\u3067\u3059\u304c\u3001<code>mousedown<\/code>\u306f\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3059\u308b\u3060\u3051\u3067\u3001<code>mouseup<\/code>\u306f\u305d\u306e\u9006\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>getmouselocation \u3067\u30de\u30a6\u30b9\u4f4d\u7f6e\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u73fe\u5728\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u304c\u3042\u308b\u4f4d\u7f6e\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<\/p>\n<pre><strong>xdotool getmouselocation<\/strong><\/pre>\n<p>\u5b9f\u969b\u306b\u5b9f\u884c\u3057\u305f\u3082\u306e\u304c\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3497\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/Screenshot-from-2019-04-12-03-01-19.png\" alt=\"\" width=\"336\" height=\"21\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/Screenshot-from-2019-04-12-03-01-19.png 336w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/Screenshot-from-2019-04-12-03-01-19-300x19.png 300w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><\/p>\n<h3>behave_screen_edge \u3067\u30de\u30a6\u30b9\u30fb\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u3051\u308b<\/h3>\n<p>\u30de\u30a6\u30b9\u304c\u4ee5\u4e0b\uff18\u3064\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u4f4d\u7f6e\u306b\u79fb\u52d5\u3057\u305f\u5834\u5408\u306b\u8d77\u52d5\u3067\u304d\u308b\u547d\u4ee4\u3067\u3059\u3002<\/p>\n<p>\uff08\u203b\u30ab\u30c3\u30b3\u5185\u306f\u30b3\u30de\u30f3\u30c9\u3067\u6307\u5b9a\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\uff09<\/p>\n<ul>\n<li>\u4e0a\uff08top\uff09<\/li>\n<li>\u53f3\uff08right\uff09<\/li>\n<li>\u4e0b\uff08bottom\uff09<\/li>\n<li>\u5de6\uff08left\uff09<\/li>\n<li>\u5de6\u4e0a\uff08top-left\uff09<\/li>\n<li>\u53f3\u4e0a\uff08top-right\uff09<\/li>\n<li>\u53f3\u4e0b\uff08bottom-right\uff09<\/li>\n<li>\u5de6\u4e0b\uff08bottom-left\uff09<\/li>\n<\/ul>\n<p>\u4f8b\u3048\u3070\u3001\u30de\u30a6\u30b9\u304c\u30b9\u30af\u30ea\u30fc\u30f3\u4e0b\u306b\u79fb\u52d5\u3057\u305f\u3068\u304d\u306b\u300ca\u300d\u3068\u5165\u529b\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool behave_screen_edge bottom key a<\/strong><\/pre>\n<p>\u203b \u305f\u3060\u3057\u79c1\u306e\u74b0\u5883\u3067\u306f\uff12\u753b\u9762\u3092\u4f7f\u3063\u3066\u3044\u308b\u304b\u3089\u304b<code>bottom<\/code>\u4ee5\u5916\u3067\u306f\u8d77\u52d5\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u74b0\u5883\u306e\u5f71\u97ff\u304c\u5f37\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>\u30a6\u30a3\u30f3\u30c9\u30a6\u95a2\u9023<\/h2>\n<h3>search \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u691c\u7d22\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u4eca\u305f\u304f\u3055\u3093\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u958b\u3044\u3066\u3044\u308b\u4e2d\u304b\u3089Google Chrome\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u63a2\u3057\u3060\u3057\u3001\u305d\u306eID\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3063\u3068\u3082\u30b7\u30f3\u30d7\u30eb\u306a\u4f8b\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool search --name chrome<\/strong><\/pre>\n<p>\u305f\u3060\u3057\u3001\u3053\u308c\u4f8b\u3060\u3068\u304a\u305d\u3089\u304f\u8907\u6570\u306eID\u304c\u53d6\u5f97\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u76ee\u306b\u898b\u3048\u3066\u3044\u306a\u3044Google Chrome\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3089\u3067\u3001\u76ee\u306b\u898b\u3048\u3066\u3044\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u307f\u53d6\u5f97\u3059\u308b\u306b\u306f<code>--onlyvisible<\/code>\u3092\u3064\u3051\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>xdotool search <strong>--onlyvisible<\/strong> --name chrome<\/pre>\n<p>\u3061\u306a\u307f\u306b\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3067ID\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre>#!\/bin\/sh\r\n\r\n<strong>window_id=$(xdotool search --onlyvisible --name chrome)<\/strong>\r\necho $window_id<\/pre>\n<h3 id=\"windowactivate\">windowactivate \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b<\/h3>\n<p>\u3042\u308b\u7279\u5b9a\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u30a2\u30af\u30c6\u30a3\u30d6\uff08\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u3066\u6700\u524d\u9762\u306b\u8868\u793a\u3055\u308c\u305f\u72b6\u614b\uff09\u306b\u3059\u308b<\/p>\n<pre><strong>xdotool windowactivate (\u30a6\u30a3\u30f3\u30c9\u30a6ID)<\/strong><\/pre>\n<h3>getactivewindow \u3067\u73fe\u5728\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u3063\u3066\u3044\u308b\u30a6\u30a3\u30f3\u30c9\u30a6ID\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<pre><strong>xdotool getactivewindow<\/strong><\/pre>\n<h3>selectwindow \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066ID\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3001\u3042\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u305d\u306e\u30a6\u30a3\u30f3\u30c9\u30a6ID\u3092\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool selectwindow<\/strong><\/pre>\n<h3>behave \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u3051\u308b<\/h3>\n<p>\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u4ee5\u4e0b\uff13\u3064\u306e\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>mouse-enter\u3000\u30fb\u30fb\u30fb\u3000\u30de\u30a6\u30b9\u304c\u305d\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u5165\u3063\u305f\u6642<\/li>\n<li>mouse-leave\u3000\u30fb\u30fb\u30fb\u3000\u30de\u30a6\u30b9\u304c\u305d\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u51fa\u305f\u6642<\/li>\n<li>mouse-click\u3000\u30fb\u30fb\u30fb\u3000\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u6642<\/li>\n<li>focus\u3000\u30fb\u30fb\u30fb\u3000\u30d5\u30a9\u30fc\u30ab\u30b9\u3055\u308c\u305f\uff08\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u306a\u3063\u305f\uff09\u6642<\/li>\n<li>blur\u3000\u30fb\u30fb\u30fb\u3000\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5931\u3063\u305f\u6642<\/li>\n<\/ul>\n<p>\u4f8b\u3048\u3070\u3001\u30de\u30a6\u30b9\u30ab\u30fc\u30bd\u30eb\u304cGoogle Chrome\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u5185\u306b\u5165\u3063\u305f\u3068\u304d\u306b\u3001\u305d\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u30bf\u30a4\u30c8\u30eb\u3092\u8868\u793a\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool search --name chrome behave %@ mouse-enter getwindowname<\/strong><\/pre>\n<h3>getwindowpid \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u306epid\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001Google Chrome\u306e<code>pid<\/code>\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool search --onlyvisible --class chrome getwindowpid<\/strong><\/pre>\n<h3>getwindowname \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30bf\u30a4\u30c8\u30eb\u30d0\u30fc\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001Google Chrome\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u691c\u7d22\u3057\u3001\u3055\u3089\u306b\u305d\u306e\u30bf\u30a4\u30c8\u30eb\u30d0\u30fc\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool search --onlyvisible --class chrome getwindowname<\/strong><\/pre>\n<h3>getwindowgeometry \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u4f4d\u7f6e\u3084\u30b5\u30a4\u30ba\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001Google Chrome\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u4f4d\u7f6e\u3068\u30b5\u30a4\u30ba\u3092\u77e5\u308a\u305f\u3044\u3068\u304d\u306b\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool search --onlyvisible --class chrome getwindowgeometry<\/strong><\/pre>\n<p>\u5b9f\u969b\u306e\u4f8b\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3506\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/Screenshot-from-2019-04-12-17-55-55.png\" alt=\"\" width=\"284\" height=\"58\" \/><\/p>\n<h3>getwindowfocus \u3067\u73fe\u5728\u30d5\u30a9\u30fc\u30ab\u30b9\u3055\u308c\u3066\u3044\u308b\u30a6\u30a3\u30f3\u30c9\u30a6ID\u3092\u53d6\u5f97\u3059\u308b<\/h3>\n<p>\u73fe\u5728\u30d5\u30a9\u30fc\u30ab\u30b9\u3055\u308c\u3066\u3044\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u306eID\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool selectwindow<\/strong><\/pre>\n<h3>windowsize \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u30fb\u30b5\u30a4\u30ba\u3092\u5909\u66f4\u3059\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u3042\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30b5\u30a4\u30ba\u3092<code>\u7e26\u6a2a\uff1d(500x300)<\/code>\u306b\u5909\u66f4\u3057\u305f\u3044\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre><strong>xdotool windowsize (\u30a6\u30a3\u30f3\u30c9\u30a6ID) 500 300<\/strong><\/pre>\n<p>\u307e\u305f\u3001\u30d4\u30af\u30bb\u30eb\u5358\u4f4d\u3067\u306f\u306a\u304f\u30d1\u30fc\u30bb\u30f3\u30c8\u3067\u3082\u6307\u5b9a\u3067\u304d\u307e\u3059<\/p>\n<pre>xdotool windowsize (\u30a6\u30a3\u30f3\u30c9\u30a6ID) <strong>50% 30%<\/strong><\/pre>\n<h3>windowmove \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u4f4d\u7f6e\u3092\u79fb\u52d5\u3055\u305b\u308b<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u3042\u308b\u30a6\u30a3\u30f3\u30c9\u30a6\u3092<code>x,y=(50,100)<\/code>\u306e\u5ea7\u6a19\u3078\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre><strong>xdotool windowmove (\u30a6\u30a3\u30f3\u30c9\u30a6ID) 50 100<\/strong><\/pre>\n<h3>windowfocus \u3067\u7279\u5b9a\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3059\u308b<\/h3>\n<pre><strong>xdotool windowfocus (\u30a6\u30a3\u30f3\u30c9\u30a6ID)<\/strong><\/pre>\n<p>\u203b \u305f\u3060\u3057\u3001\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b\u5834\u5408\u306f<a href=\"#windowactivate\">windowactivate<\/a>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>windowminimize \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u6700\u5c0f\u5316\u3059\u308b<\/h3>\n<pre><strong>xdotool windowminimize (\u30a6\u30a3\u30f3\u30c9\u30a6ID)<\/strong><\/pre>\n<h3>windowkill \u3067\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u7d42\u4e86\u3055\u305b\u308b<\/h3>\n<pre><strong>xdotool windowkill (\u30a6\u30a3\u30f3\u30c9\u30a6ID)<\/strong><\/pre>\n<h2>\u305d\u306e\u4ed6<\/h2>\n<h3>sleep\u3067\u4e00\u5b9a\u6642\u9593\u5f85\u3064<\/h3>\n<p>\u4f8b\u3048\u3070\u3001\uff11\uff10\u79d2\u5f85\u6a5f\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool sleep 10<\/strong><\/pre>\n<p>\u307e\u305f\u3001\uff15\u79d2\u5f85\u3063\u3066\u304b\u3089\u300ca\u300d\u3092\u5165\u529b\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>xdotool sleep 5 key a<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u30df\u30ea\u79d2\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u5c0f\u6570\u70b9\u3092\u3064\u3051\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>xdotool sleep 0.01<\/strong><\/pre>\n<h1>\u3061\u306a\u307f\u306b<\/h1>\n<p><code>xdotool<\/code>\u306b\u306f\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u95a2\u9023\u306e\u64cd\u4f5c\u3082\u3067\u304d\u308b\u3089\u3057\u3044\u306e\u3067\u3059\u304c\u3001\u79c1\u306e\u74b0\u5883\u3067\u5b9f\u884c\u3057\u305f\u3068\u3053\u308d\u5168\u304f\u5909\u5316\u304c\u306a\u304b\u3063\u305f\u308a\u3001\u3042\u307e\u308a\u6709\u52b9\u3060\u3068\u601d\u3048\u308b\u3082\u306e\u304c\u306a\u304b\u3063\u305f\u306e\u3067\u4eca\u56de\u306f\u7701\u7565\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001<code>xdotool<\/code>\u306e\u5404\u30b3\u30de\u30f3\u30c9\u306b\u306f\u69d8\u3005\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"http:\/\/manpages.ubuntu.com\/manpages\/trusty\/man1\/xdotool.1.html\">xdotool &#8211; command-line X11 automation tool<\/a><\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u305f\u307e\u30fc\u306b\u66f8\u3044\u3066\u3044\u308b\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u306eLinux\u95a2\u9023\u306e\u8a71\u984c\u3067\u3057\u305f\u3002\u304a\u305d\u3089\u304f\u305d\u308c\u307b\u3069\u9700\u8981\u304c\u591a\u3044\u3068\u306f\u601d\u3044\u307e\u305b\u3093\u304c\u3001\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u305f\u3066\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\uff01<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u266a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u306e\u3068\u3053\u308dPHP\u3084JavaScript\u306e\u8a18\u4e8b\u3070\u304b\u308a\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3001\u305f\u307e\u306b\u306f\u3082\u3063\u3068\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u74b0\u5883\u306e\u3082\u306e\u3082\u3084\u3063\u3066\u307f\u3088\u3046\u3068\u3044\u3046\u6c17\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u3002  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=3477\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;xdotool \u30b3\u30de\u30f3\u30c9\u5168\uff12\uff16\u5b9f\u4f8b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":3512,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,2],"tags":[132],"class_list":["post-3477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-2","tag-132"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/3477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3477"}],"version-history":[{"count":31,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/3477\/revisions"}],"predecessor-version":[{"id":3511,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/3477\/revisions\/3511"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/3512"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}