*AutoHotkey [#h82df47d] #contents **概要 [#adea700f] [[AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/]]より~ > AutoHotkeyはホットキーへの機能の割り当てなど常駐ソフトの作成に特化したスクリプトエンジンである。 多彩なコマンドが用意されており、GUIを持ったプログラムの作成も可能。 GNU GENERAL PUBLIC LICENSE Version 2の下で配布されるフリーソフトで、C++で作られている。 公式サイト(http://www.autohotkey.com/)にて、インストーラー版とZIPアーカイブ版の2種類が配布されている。 インストーラーを実行すると、スタートメニュー、新規作成メニュー、関連付けに変更が加えられる。 -自動化 - 所謂マクロ。 -ホットキー - スクリプトを常駐、特定のキーやボタンが押されたときにひとつ、あるいは複数の機能を割り当て。 -[[Hotstring:http://lukewarm.s101.xrea.com/Hotstrings.html]] - 日本語での利用には多少工夫が必要。 -GUI - GUI を設定できる。CUIのソフトのフロントエンドなどはおてのもの。 -[[リマップ:http://lukewarm.s101.xrea.com/remap.html]] - キーやボタンをリマップできる。 特定のウィンドウやウインドウ毎にリマップすることも可能。 -実行ファイル - 実行に必要なファイルとともに自作スクリプトを実行ファイルに変換可能。AHKがインストールされていない環境に向けても配布が可能に。 詳しい特徴と機能についての紹介は [[AutoHotkeyを流行らせるページ → イントロダクション:http://lukewarm.s101.xrea.com/Introduction.html]] でされています。 //''初心者の場合''、作業の省力化、効率化、自動化などを目的にホットキーへの機能の割り当て、キーボードリマップ、マクロを組む、といった用途でAHK(AutoHotkey)を利用するのは問題ないんですが、(きっかけとしてはありかもしれませんが)'''プログラミング学習目的'''でAHKの選択はしない方が賢明だと思います。 **スクリプト [#e4410784] //解説待ち **DllCall [#b8001daa] ホットキーへの機能の割り当て以外に、GUIがあり、DllCall(([[DllCall() - AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/commands/DllCall.html]]))がかなり強力な事もあり(向き不向きはありますが)大抵の事は出来ると思います。 //解説待ち -→[[参考リンク>#yc223dfb]] **COM [#xe018ac5] COM(([[Component Object Model - Wikipedia:http://ja.wikipedia.org/wiki/Component_Object_Model]]))を利用する事も出来ます。 //解説待ち -→[[参考リンク>#udcd699d]] **FAQ [#kcda885c] -[[AutoHotkey FAQ:http://www.autohotkey.com/docs/FAQ.htm]] -[[Tutorial for Newbies:http://www.autohotkey.com/forum/topic29204.html]] -AutoHotkeyを流行らせるページ →[[FAQのスレ:http://lukewarm.s101.xrea.com/test/read.cgi/bbs/1200674082/]] -[[Tips N Tricks:http://www.autohotkey.com/forum/topic8795.html]] -[[engunneer's home thread:http://www.autohotkey.com/forum/topic21919.html]] - ミニ FAQ : "This is a thread for me to keep common answers handy for forum linking" ***Q.文字化け?ダメ文字? [#oc2f06dc] A. -エスケープ文字(([[エスケープ文字 - AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/Scripts.htm#escape]])):#EscapeChar(([[#EscapeChar - AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/commands/_EscapeChar.htm]]))での対処 :[[AutoHotkey スレッド part6:http://pc11.2ch.net/test/read.cgi/software/1219130051/]]より~| > Q:「~AチЯ㌔荏柿義形港餐汁秦疏蛋伝覗描冒輿倭兪啻嫣彖拜杼歔」を含む文字列がうまく扱えないよ A:これらの文字の2バイト目が、AHKのエスケープ文字である0x60[`]なため。 対処としてはこれらの文字の"直後"に「`」を記述する(例:「線形`代数」)か、 #EscapeCharでエスケープ文字を別のものに変えるべし。 -対策用の関数、ライブラリ - [[参考リンク>ダメ文字問題対策>#w52e9b62]]を参照。 ***Q.コンパイルした実行ファイルがアンチウイルスソフトに怒られるんだけど? [#ia1516a8] A.[[Compile_AHK II>AutoHotKey#Compile_AHK2]] を試してみて下さい(08年12月14日現在)。"No UPX"オプションがあるので、UPXで圧縮しないでコンパイルしてみて下さい。 もしかしたら改善されるかもしれません。~ 関連用語:[[実行ファイル圧縮>プログラミング用語#exe_comp-ja]] //{{追加お願いします。}} **参考リンク [#la6d4373] :[[AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText:http://www.autohotkey.com/]]| 公式サイト :[[AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/]]| 日本に於ける総本山 ***スクリプト [#v67b1dcd] :[[AutoHotkey Script Showcase:http://www.autohotkey.com/docs/scripts/]]| スクリプトサンプル。 :[[AutoHotkey wiki - Category:Scripts - AutoHotkey:http://www.autohotkey.com/wiki/index.php?title=Category:Scripts]] , [[Script Listing - AutoHotkey:http://www.autohotkey.com/wiki/index.php?title=Script_Listing]]| 目当てのスクリプト(の記事)を見つけるのに[[Forum:http://www.autohotkey.com/forum/]]から検索((検索用スクリプトの公開もされていたりします:[[Quick Search for Autohotkey:http://www.autohotkey.com/forum/viewtopic.php?p=196070#196070]]))して探すのが大変なら、先ずこのページにあるリンクからあたってみましょう。 - 中には古い記事もあるので記事の日付け、内容に注意。 :[[AutoHotkeyを流行らせるページ → My Scripts:http://lukewarm.s101.xrea.com/myscripts/index.html]]| AutoHotkeyを流行らせるページの管理人さんが作成したスクリプト、ライブラリ各種。 ***DllCall [#yc223dfb] :[[API Wrappers - AutoHotkey wiki:http://www.autohotkey.com/wiki/index.php?title=API_Wrappers]]| WinAPI ((Windowsが提供するさまざまな機能:[[Windows API - Wikipedia:http://ja.wikipedia.org/wiki/Windows_API]]))にアクセス出来ます。 :[[Windows Data Types lookup tool - Autohotkey forums:http://www.autohotkey.com/forum/topic12036.html]]| WinAPI関連:補助スクリプト :[[Crazy Scripting : A handy tool to lookup Win32 Constants - Autohotkey forums:http://www.autohotkey.com/forum/topic19766.html]]| WinAPI関連:補助スクリプト "W32C_R01.CSV is a listing of 11836 Constants" :[[Easy WinAPI - WinAPI Parser, DllCall with single hotkey - Autohotkey forums:http://www.autohotkey.com/forum/topic33464.html]]| WinAPI関連:補助スクリプト :[[StructParser (for C/C++ structs) - Autohotkey forums:http://www.autohotkey.com/forum/topic27644.html]]| 補助スクリプト: →[[Known Issues - Autohotkey forums:http://www.autohotkey.com/forum/post-172883.html&sid=9497a16de8656b80cdf59bb961cb2ec1#172883]] :[[Crazy Scripting : WinAPI Listing:http://www.autohotkey.com/forum/topic39649.html]]| WinAPI関連:補助スクリプト - MSDNライブラリでWinAPI関数を検索、ブラウザで表示。 :[[win32help.ahk (Win32 API 用ラッパ作成ヘルパスクリプト):http://yak.myhome.cx/junks/#ahk]]| DllCall() のラッパ、構造体操作ラッパ、加えて定数定義を作成するためのヘルパスクリプト - Requires: C++ コンパイラ、 Win32 API のヘッダ :[[OpenGL DllCalls - Autohotkey forums:http://www.autohotkey.com/forum/topic31078.html]]| OpenGL(([[OpenGL - Wikipedia:http://ja.wikipedia.org/wiki/OpenGL]])) in AHK. 関連:[[Zippos OpenGL - AHK 3D-Engine. - Autohotkey forums(独語):http://de.autohotkey.com/forum/topic3977.html]]→[[操作解説(英語)-Keys - Autohotkey forums:http://www.autohotkey.com/forum/post-233842.html&sid=9d3510f63696c83c85be97d91f0a2253#233842]] :[[GDI+ standard library 1.26 by tic:http://www.autohotkey.com/forum/topic32238.html]]| GDI+ (([[Graphics Device Interface - Wikipedia:http://ja.wikipedia.org/wiki/Graphics_Device_Interface#GDI.2B]])) :サンプル - [[ [examples+minituts] The GDI+ Examplecodes thread:http://www.autohotkey.com/forum/topic37859.html]] //standard library (StdLib) どこまで紹介するのがいいだろう? //もう少し整備されてからの方がいいのか? - http://www.autohotkey.com/forum/topic22214.html //こっちも動きがあるようだ - http://www.autohotkey.com/forum/topic22548.html //AHKが方向性の一つとして、例えばHSPとかなでしこの様な方向へも伸びてくとしたら、 //ライブラリの充実とそれを紹介する機会をもっと設ける必要を感じるんだよなー… //OOP(http://www.autohotkey.com/forum/topic40293.html)とかも出てきてるしなー //日本語のドキュメントもこれまで以上に必要だよなー…… //>日本語のドキュメント ←で、誰がやるん? //そこはやっぱり『流行らせるページ』の方で… //『流行らせるページ』の方で、って管理人さんに押し付ける訳にはいかないし、スレを建てるの? //BBSのような形式よりはライブラリのまとめサイト(wiki)見たいなのを新設するとかの方が良いような気もするかなー //日本のユーザーは『HSPとかなでしこの様な』方向性は望んでないんじゃねーの? //『ライブラリのまとめサイト(wiki)見たいなの』はいいかもしれんけど //方向性はともかく、OOP (Class library)なんかを中心にするとかして //文字通り標準のライブラリとして纏めてくれないかなー。 // http://www.autohotkey.net/~animeaime/ClassLibrary/ // - もう少し成り行き見てみるかな。 //あ、まとめサイト <del>作っても無駄にはならないだろうし、やりたい人ドゾ。</del> anyone? //↑『ライブラリのまとめサイト(wiki)見たいなの』向けのアイデア。 //共通のフォーマットとしてahkml http://www.autohotkey.net/~Tuncay/ahkcollec/ahkml10-doc.txt なんか利用できると思うんだけどな。 //AutoHotkey Script Collection http://www.autohotkey.net/~Tuncay/ahkcollec/ahkcollec.xml //拡張して 入力補完用、ツールチップ用のファイルも提供できるように、とかおもしろいと思うんだけどなー。 //でも、ahkmlそのものが殆んど認知されてないみたいなんだよなー ……。 //っていうか プログラミングスレまとめ で収まる話じゃないよなー。 //誰も手を挙げないならソフ板か流行らせるページの方へ投げたほうが良いと思うが。ていうか投げちゃうゾ? ***COM [#udcd699d] :[[COM Wrappers - AutoHotkey wiki:http://www.autohotkey.com/wiki/index.php?title=COM_Wrappers]]| いくつかCOMラッパーの提供もされています。 :[[COM Standard Library - Autohotkey forums:http://www.autohotkey.com/forum/topic22923.html]]| → [[関数ライブラリスクリプト:http://lukewarm.s101.xrea.com/Function.html#library]]、[[#Include:http://lukewarm.s101.xrea.com/commands/_Include.html]] - [[AutoHotkeyを流行らせるページ:http://lukewarm.s101.xrea.com/]] :[[Embed an Internet Explorer control in your AHK Gui via COM - Autohotkey forums:http://www.autohotkey.com/forum/topic19225.html]]| "This is a standard library for IE/WebBrowser controls."~ 関連:[[IE and Gui Browser Com Tutorial - Autohotkey forums:http://www.autohotkey.com/forum/topic34972.html]] :[[Windows Scripting for Autohotkey - official homepage:http://www.autohotkey.net/~easycom/]]| VBScript,JScriptの組み込み - "Embed VBScript or JScript directly in your Autohotkey programs." : [[Embedded Windows Scripting (VBScript & JScript) and COM - official thread in the Autohotkey forums:http://www.autohotkey.com/forum/topic21674.html]] :[[AutoHotkeyを流行らせるページ → My Scripts → ActiveX:http://lukewarm.s101.xrea.com/myscripts/index.html]]| WSH等で使われるActiveXObjectを扱えるようにする ***ダメ文字問題対策 [#w52e9b62] -[[新・なまず日記(2006-01-11) - AutoHotkeyのダメ文字問題対策:http://www.tierra.ne.jp/~aki/diary/?date=20060111#p01]] -[[(AutoHotkey)(IMEの制御をする 編) - もらかなです。:http://d.hatena.ne.jp/morakana/20080213/1202876561]] -[[クリップボードを使わないで全角文字を貼付ける - eamatの日記:http://d.hatena.ne.jp/eamat/20050921/p1]] -[[AutoHotkeyでマルチバイト(全角)文字を文字化けなしで出力する関数 - ナレッジデータベース モバイル:http://it.kndb.jp/m/entry/id/1188]] :AutoHotkey駄目文字微対策版| [[物置 > AutoHotkey:http://yak.myhome.cx/junks/#ahk.cp932]]~ 1.0.47.06ベースにされたようです(08年12月25日現在)。~ ''注'')文字列処理(含:正規表現)では依然駄目文字等の問題は残ります。 ***デバッグ あれこれ [#c2514e63] :[[AutoHotkeyを流行らせるページ → スクリプト → スクリプトのデバッグ:http://lukewarm.s101.xrea.com/Scripts.html]]| スクリプトが期待通りに動作しているかを確認するには :[[AutoHotkeyを流行らせるページ → リファレンス → OutputDebug:http://lukewarm.s101.xrea.com/commands/OutputDebug.html]]| デバッガ([[DebugView>AutoHotKey#DebugView]]など)に文字列を出力 :[[110.22 Ahk script Debugger 1.1.5b (line-by-line capable):http://www.autohotkey.com/forum/topic7302.html]]| "An interactive AHk debugger" :[[Debugging - Autohotkey forums:http://www.autohotkey.com/forum/topic23678.html]]| Debug helper スクリプト など :[[Debug() [Func] - Autohotkey forums:http://www.autohotkey.com/forum/topic31416.html]]| > if you're working with #Include files function must be called from itself rather than calling from d.ahk to show correct info for currently executing function/filename :[[debugging using A_LIneNumber - Autohotkey forums:http://www.autohotkey.com/forum/topic24397.html]]| RunDebugView.ahk - [[DebugView>AutoHotKey#DebugView]] を利用。 :[[Gui, Show bug - Autohotkey forums:http://www.autohotkey.com/forum/topic17316.html]]| Trace.ahk - [[DebugView>AutoHotKey#DebugView]] を利用。 //:[[DllCallDebugger Proof of Concept:http://www.autohotkey.com/forum/topic36665.html]]| //Requires: LowLevel.ahk([[LowLevel & dynamic code:http://www.autohotkey.com/forum/topic26300.html]]) // タイトルが変わっていた↑ and バージョンアップしていたので置き換え↓ :[[DebugBIF - debug built-in functions (was DllCallDebugger):http://www.autohotkey.com/forum/topic36665.html]] - for AutoHotkey v1.0.48| appropriate version of [[LowLevel:http://www.autohotkey.com/forum/topic26300.html]] are required. **Tools [#c138c78c] :&aname(DebugView){DebugView};([[DebugView for Windows - © Microsoft Corporation.:http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx]])| デバッグトレースを表示 ::使い方 - 参考:|[[差をつけるデバッグ術! ~ 知られざるログ出力 - プログラミング徹底解説:http://keicode.com/windows/win15.php]] :[[Dependency Walker (depends.exe) Home Page:http://www.dependencywalker.com/]]| 最新版:2.2.6000が入手できる~ [[Dependency Walker 日本語化パッチ+α - G-PROJECT:http://www.gprj.net/wiki/index.php?title=Dependency_Walker_%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%8C%96%E3%83%91%E3%83%83%E3%83%81%2B%CE%B1]]~ [[Dependency Walkerの文字化け対策 - G-PROJECT:http://www.gprj.net/wiki/index.php?title=Dependency_Walker%E3%81%AE%E6%96%87%E5%AD%97%E5%8C%96%E3%81%91%E5%AF%BE%E7%AD%96]]~ [[[SMS] Dependency Walker for Win32 (Depends.exe) について:http://support.microsoft.com/kb/198707/ja]] :[[DLL Export Viewer:http://www.nirsoft.net/utils/dll_export_viewer.html]]| システム内のdll/指定したdllの関数をスキャン :[[Dll Export Finder:http://jacquelin.potier.free.fr/dllexportfinder/]]| 指定したディレクトリのdllの関数をスキャン :[[ActiveVB - ApiViewer (en):http://www.activevb.de/rubriken/apiviewer/index-apiviewereng.html]]| WinAPIビューワー :[[COMView:http://www.japheth.de/COMView.html]]| PSDK付属のOleView.Exeの代替として使用できるツール :[[MiTeC OLE/COM Object Explorer:http://www.mitec.cz/Data/XML/data_downloads.xml]]| PSDK付属のOleView.Exeの代替として使用できるツール :[[SPY for Internet Explorer:http://darksky.biz/index.php/Software/SPY%20for%20Internet%20Explorer]]| 実行中のInternet Explorerで発生するイベントの監視(WebBrowser control) **mini info [#v3454dba] //:%%[[Beta version pre-v1.0.48: Up to 3x faster performance - Autohotkey forums:http://www.autohotkey.com/forum/viewtopic.php?t=38034]]%%| //%%赤くは無いけど、AutoHotkey本体のBetaバージョン(pre-v1.0.48)は三倍速くなってるそうです。%% :[[AutoHotkey:http://www.autohotkey.com/]] - Feb 25, 2009 Version 1.0.48 is released.| "It is up to 3 times as fast, especially for numerically-intensive scripts. ..." - [[AutoHotkey Changes and New Features:http://www.autohotkey.com/changelog/]] / [[v1.0.48 released: Runs up to 3x as fast. Adds while-loop.:http://www.autohotkey.com/forum/topic41393.html]] :&aname(Compile_AHK2){Compile_AHK II};([[Compile_AHK II - for those who compile! - Autohotkey forums:http://www.autohotkey.com/forum/topic22975.html]])| Update of 2008-11-05 以降、"No UPX"オプション(GUI)が付いています。(コンパイラそのものは公式サイトで配布されているものに標準で付いて来ます) - [[Viruses found in executable after compile:http://www.autohotkey.com/forum/topic30084.html]] , [[Tutorial: How to compile .AHK files and include your own ico:http://www.autohotkey.com/forum/topic41058.html]] //:[[SciTE4AutoHotkey - メニューの日本語化and日本語入力:http://www8.uploader.jp/dl/vipprog/vipprog_uljp00625.txt.html]]| //SciTE をAutoHotkey用に最適化された [[SciTE4AutoHotkey:http://www.autohotkey.net/~fincs/SciTE4AutoHotkey/index.htm]] の日本語化手順。~ //Forum内のスレッド:[[SciTE4AutoHotkey - New version:http://www.autohotkey.com/forum/topic19323.html]] :[[SciTE4AutoHotkey v2:http://www.autohotkey.net/~fincs/SciTE4AutoHotkey_2/web/]] stable| [[SciTE4AutoHotkey v2 - New SciTE4AHK version in the making:http://www.autohotkey.com/forum/topic40241.html]] , [[SciTE4AutoHotkey v2 Stable - Released.:http://www.autohotkey.com/forum/topic41503.html]] ::[[SciTE4AutoHotkey2-ja_1.1.zip:http://www8.uploader.jp/dl/vipprog/vipprog_uljp00722.zip.html]]| "SciTE4AutoHotkey v2" メニュー日本語化パック //修正版:09年3月23日 ::[[AutoHotkey_L (Lexikos' custom build) - ''"pre-release"'' DBGp client functions written in AutoHotkey:http://www.autohotkey.com/forum/post-256592.html#256592]] - "Hopefully we will see interactive debugging in SciTE4AutoHotkey in the not-too-distant future."| 関連:[[AutoHotkey_L - Debugging Features:http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Debugging_Features.htm]] 、 [[InteractiveDebugging.avi:http://www.autohotkey.com/forum/post-257669.html#257669]] - 基本的なデバッグの様子を収めたスクリーンキャスト。 //まだ "pre-release" だけど、ここは "mini info" の枠だからいいよね? :[[ironahk - Google Code:http://code.google.com/p/ironahk/]]| クロスプラットホーム向けに開発が進められているAutoHotkeyからのフォーク。~ Forum内のスレッド:[[IronAHK - .NET port of AutoHotkey for Windows, Linux, Mac...:http://www.autohotkey.com/forum/topic34421.html]] ::[[scite-4-ironahk - Google Code:http://code.google.com/p/scite-4-ironahk/]]| IronAHK 仕様の SciTE :chm版リファレンス - [[スクリプト投稿スレ > 127:http://lukewarm.s101.xrea.com/test/read.cgi/bbs/1092315194/127]]| 『AutoHotkeyを流行らせるページ』のHTML HELP版、 v1.0.47.00 対応。