当然 AIR だけでは外部プログラムの実行はできませんので、 HTTP コマンド・リスナー を使用します ![]() ブラウザでダウンロード ![]() COMMAND_LISTENER.exe に対する http 呼び出し【VBS & PHP】スクリプトからスタンバイ状態にする で作成した VBScript を呼び出して、スタンバイ状態に移行します。 以下のコードの night の部分を自分の PC に置き換えてビルドします 01. import mx.controls.*; 02. import mx.events.*; 03. import mx.rpc.events.*; 04. import mx.formatters.*; 05. import flash.external.*; 06. import flash.events.*; 07. 08. include "Parts.as" 09. 10. // ***************************************************** 11. // HTTPServiceを使用してHTTPリクエスト(GET)を行う 12. // ***************************************************** 13. private function sendData(): void { 14. // ● リクエストするURLをセット 15. // ★ http:// で記述すると、ベースが ローカルでも動作します 16. srv.url = "http://night:50000/wscript.exe|shell_standby.vbs" ; 17. 18. srv.method = "GET" ; 19. srv.send(); 20. 21. } 22. 23. // ***************************************************** 24. // HTTPServiceが成功 25. // ***************************************************** 26. private function resultHandler(e:ResultEvent): void { 27. 28. 29. } 30. 31. // ***************************************************** 32. // HTTPServiceでエラーが発生した 33. // ***************************************************** 34. private function faultHandler(e:FaultEvent): void { 35. 36. Alert.show(e.fault.message); 37. 38. } VBScript呼び出すのは何でも良いのですが、いきなりスタンバイにならないように その部分はコメントにしてあります 01. Set WshShell = CreateObject( "WScript.Shell" ) 02. Set Shell = CreateObject( "Shell.Application" ) 03. 04. Shell.ShutdownWindows() 05. 06. WScript.Sleep 100 07. 08. WshShell.AppActivate "Windows のシャットダウン" 09. 10. WScript.Sleep 100 11. 12. ' WshShell.SendKeys "{DOWN}{DOWN}{DOWN}{ENTER}" その他アイコン画像は、こちら からダウンロード できるフリーのアイコンです( 商用は不可 ) ![]() WindowedApplication なんですが、ルートのオブジェクトの参照は WindowedApplication(mx.core.Application.application) で動いています??? 画面は systemChrome を使用せずに、Frex Chrome を使用しています 01. <? xml version = "1.0" encoding = "utf-8" ?> 02. < application xmlns = "http://ns.adobe.com/air/application/1.0" > 03. 04. < id >airApplication</ id > 05. < version >1.0</ version > 06. < filename >airApplication</ filename > 07. 08. < initialWindow > 09. < title >AIR アプリケーション</ title > 10. < content >Mainw.swf</ content > 11. < x >300</ x > 12. < y >200</ y > 13. < width >600</ width > 14. < height >540</ height > 15. < systemChrome >none</ systemChrome > 16. < transparent >true</ transparent > 17. < visible >true</ visible > 18. < minimizable >true</ minimizable > 19. < maximizable >true</ maximizable > 20. < resizable >true</ resizable > 21. </ initialWindow > 22. 23. </ application > 01. <? xml version = "1.0" encoding = "utf-8" ?> 02. < mx:WindowedApplication 03. xmlns:mx = "http://www.adobe.com/2006/mxml" 04. initialize = "initData();" 05. title = " ● Flex Chrome タイトル" 06. titleIcon = "@Embed('icon.png')" 07. > 08. 09. < mx:Style source = "extern/Style.css" /> 10. < mx:Script source = "extern/Script.as" /> 11. 12. < mx:HTTPService 13. id = "srv" 14. showBusyCursor = "true" 15. result = "resultHandler(event)" 16. fault = "faultHandler(event)" 17. /> 18. 19. < mx:Panel 20. title = "HTTP サーバー呼び出し" 21. horizontalAlign = "center" 22. verticalAlign = "middle" 23. width = "90%" 24. height = "90%" 25. paddingLeft = "10" 26. paddingRight = "10" 27. backgroundColor = "0x8A0029" 28. backgroundAlpha = "0.3" 29. color = "silver" 30. > 31. 32. < mx:Button 33. id = "btn" 34. label = "実行" 35. click = "sendData()" 36. styleName = "blackButton" 37. /> 38. 39. </ mx:Panel > 40. 41. </ mx:WindowedApplication > |