前の記事で、複数の接続先が選べるようなメニューの作成をしたので、これを作りこんで配布用のexeファイルを作成します。
最終的に、実行するとこんなメニュー画面が表示され、接続できるようになりました。
まず、メニュー画面を作りこみます。ソースは以下のようになりました。
[menu.au3]
#NoTrayIcon
#include
#include
Global $ExitID_Main()
Func _Main()
;###############################################
;# Setting
;###############################################$SupportTitle = "リモートサポート接続"
$supportVer = " v2010.4.29"
$SupportConnectDst = "サポートするホストIP"
$startport = 5501
$iconlogo = "icon.ico"
$bmplogo = "logo.bmp" ;235x165で$text1 = "[お問い合わせはこちら]"
$text2 = "TEL 050-xxxx-xxxx"
$text3 = "FAX 050-xxxx-xxxx"
$text4 = "※接続ボタンでサポートが開始されます"$textcorp = 'kenti.jp All rights Reserved.'
;###############################################
;
;; GUI
GuiCreate($SupportTitle & " " & $SupportVer , 470, 260,-1,-1, _
BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), _
BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GuiSetIcon($iconlogo); GROUP WITH RADIO BUTTONS
GuiCtrlCreateGroup("番号を選択し接続をクリックしてください", 10, 10)$SupportID1 = GuiCtrlCreateRadio("サポートセンター 接続1", 30, 40, 140)
$SupportID2 = GuiCtrlCreateRadio("サポートセンター 接続2", 30, 60, 140)
$SupportID3 = GuiCtrlCreateRadio("サポートセンター 接続3", 30, 80, 140)
$SupportID4 = GuiCtrlCreateRadio("サポートセンター 接続4", 30, 100, 140)
$SupportID5 = GuiCtrlCreateRadio("サポートセンター 接続5", 30, 120, 140)$SupportID = 0
GuiCtrlSetState($SupportID1, $GUI_CHECKED)
GUICtrlCreateGroup ("",-99,-99,1,1) ;close group;image logo
GUICtrlCreateGroup("",215, 10, 245, 180)
GUICtrlCreatePic($bmplogo,220,20,235,165)
GUICtrlCreateGroup("", -99, -99, 1, 1);text right
;_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
GUICtrlCreateLabel($text1, 10, 170)
GUICtrlCreateLabel($text2, 10, 185)
GUICtrlCreateLabel($text3, 10, 200)GUICtrlCreateLabel($text4, 10, 220)
;;tet left
GUICtrlCreateLabel($textcorp, 215, 200)
; BUTTON
$ConnectID = GuiCtrlCreateButton("接続", 260, 220, 100, 30)
$ExitID = GuiCtrlCreateButton("終了", 370, 220, 50, 30)
; GUI MESSAGE LOOPGuiSetState()
Do
$msg = GUIGetMsg()Select
Case $msg >= $SupportID1 And $msg <= $SupportID5
$SupportID = $msg - $SupportID1
Case $msg = $ConnectID
$port = $startport + $SupportID
Run(".\winvnc4.exe -localhost","",@SW_HIDE)
sleep(2000)
Run(".\winvnc4.exe -connect "& $SupportConnectDst &":" & $port ,"",@SW_HIDE)Exitloop
EndSelect
Until $msg = $GUI_EVENT_CLOSE Or $msg = $ExitID
EndFunc ;==>_Main
上記のmenu.au3内にあるicon.icoやlogo.bmpは、メニューで使用される画像と、タスクバーに表示されるアイコンとして使用しています。
準備ができたら、Autoitにてこのスクリプトをexe化します。
次に、出来上がった menu.exe のほか、icon.ico , logo.bmp , winvnc4.exe を同一のフォルダにおき、7-Zipで圧縮し support.7z を作成します。
[コマンドプロンプトから support.7z を作成]
C:\> 7zr.exe a support.7z menu.exe winvnc4.exe logo.bmp icon3.ico
次に、以下のような config.txt を作成します。このファイルは、spport.7zをexe化する際、一番最初に実行されるファイル名を記述しておくもので、後述するsupport.exeを作成する際に必要です。これも同じフォルダに入れておいてください。
[config.txt]
;Title=""
;BeginPrompt=""
ExecuteFile="menu.exe"
;!@InstallEnd@!
その後、出来上がった support.7z を、前回作成した要領で 7z-sfxを使用し、exe化します。
[support.exeを作成する]
C:\> COPY /B .\etc\7-zip\7zS.sfx + config.txt + support.7z support.exe
これでサポート用の実行ファイルが作成されました。

あとはこの実行ファイルをHP上にアップしておいたり、サポートが必要な人に渡してサポートをすることが可能になります。

コメントする