製作VirtualBox 3.0.6自動安裝檔
VirtualBox是一個虛擬機器的軟體,我喜歡用他來架設測試用的機器,以及快速安裝Koha跟DSpace。然而VirtualBox安裝步驟多,我希望能夠簡化這個程序,因此開始研究起自動安裝的方法。(此處使用的是VirtualBox 3.0.6,自由軟體)
AutoIT,可以script(腳本檔)程式來控制你電腦中任何操作,甚至臨時建立表單、問答視窗,都可以作到。他也常被用來作為自動安裝的用途,也包括了自動安裝VirtualBox。(此處使用的是AutoIT V3)
修改了左又天撰寫的自動安裝script,我也利用IconsExtract抽取出VirtualBox的icon檔案,接著就可以利用WinRAR來製作自我解壓縮檔。(此處我使用的是3.61中文版)
最後的結果,就放在此處讓人下載:
另外放上我改過的AutoIT Script 檔案,但是最後的網卡安裝並沒有寫得很好,請各位先進多多指教:
Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) RUN("VirtualBox.exe") WinWait("Sun VirtualBox Setup","The Setup Wizard wil") If Not WinActive("Sun VirtualBox Setup","The Setup Wizard wil") Then WinActivate("Sun VirtualBox Setup","The Setup Wizard wil") WinWaitActive("Sun VirtualBox Setup","The Setup Wizard wil") Send("{ALTDOWN}n{ALTUP}") WinWait("Sun VirtualBox License Agreement","I &accept the terms ") If Not WinActive("Sun VirtualBox License Agreement","I &accept the terms ") Then WinActivate("Sun VirtualBox License Agreement","I &accept the terms ") WinWaitActive("Sun VirtualBox License Agreement","I &accept the terms ") ControlFocus("Sun VirtualBox License Agreement", "", "Button2") Send("{ALTDOWN}n{ALTUP}") WinWait("Sun VirtualBox Setup","") If Not WinActive("Sun VirtualBox Setup","") Then WinActivate("Sun VirtualBox Setup","") WinWaitActive("Sun VirtualBox Setup","") Send("{ALTDOWN}n{ALTUP}") sleep(1000) ControlFocus("Sun VirtualBox Setup", "", "Button2") Send("{space}") Send("{ALTDOWN}n{ALTUP}") WinWait("Sun VirtualBox ","Installing the Sun V") If Not WinActive("Sun VirtualBox ","Installing the Sun V") Then WinActivate("Sun VirtualBox ","Installing the Sun V") WinWaitActive("Sun VirtualBox ","Installing the Sun V") Send("{ALTDOWN}y{ALTUP}") WinWait("Sun VirtualBox Setup","") If Not WinActive("Sun VirtualBox Setup","") Then WinActivate("Sun VirtualBox Setup","") WinWaitActive("Sun VirtualBox Setup","") Send("{ALTDOWN}i{ALTUP}") WinWait("軟體安裝","繼續安裝這個軟體會在") If Not WinActive("軟體安裝","繼續安裝這個軟體會在") Then WinActivate("軟體安裝","繼續安裝這個軟體會在") WinWaitActive("軟體安裝","繼續安裝這個軟體會在") Send("{ALTDOWN}c{ALTUP}") WinWait("軟體安裝","") If Not WinActive("軟體安裝","") Then WinActivate("軟體安裝","") WinWaitActive("軟體安裝","") Send("{ALTDOWN}c{ALTUP}") WinWait("軟體安裝","") If Not WinActive("軟體安裝","") Then WinActivate("軟體安裝","") WinWaitActive("軟體安裝","") Send("{ALTDOWN}c{ALTUP}") WinWait("硬體安裝","您正要為這個硬體安裝") If Not WinActive("硬體安裝","您正要為這個硬體安裝") Then WinActivate("硬體安裝","您正要為這個硬體安裝") WinWaitActive("硬體安裝","您正要為這個硬體安裝") Send("{ALTDOWN}c{ALTUP}") WinWait("硬體安裝","您正要為這個硬體安裝") If Not WinActive("硬體安裝","您正要為這個硬體安裝") Then WinActivate("硬體安裝","您正要為這個硬體安裝") WinWaitActive("硬體安裝","您正要為這個硬體安裝") Send("{ALTDOWN}c{ALTUP}") Sleep(10000) Send("{ALTDOWN}c{ALTUP}") Sleep(3000) Send("{ALTDOWN}n{ALTUP}") WinWait("Sun VirtualBox Setup","Start Sun VirtualBox") If Not WinActive("Sun VirtualBox Setup","Start Sun VirtualBox") Then WinActivate("Sun VirtualBox Setup","Start Sun VirtualBox") WinWaitActive("Sun VirtualBox Setup","Start Sun VirtualBox") Send("{SHIFTDOWN}{TAB}{SHIFTUP}") Send("{SPACE}") Send("{ALTDOWN}f{ALTUP}")
參考來源
[教學] 封裝AutoIt自動安裝程式 - 軟件討論區 - SUM-HK論壇提供/新聞/娛樂/數碼/音樂/電影等資訊~~ - Powered by Discuz! . Retrieved October 5, 2009, from http://sum-hk.marlito.com/redirect.php?tid=760&goto=lastpost.
VirtualBox 3.0.6 一鍵安裝 完整封裝 圖文教學(Autoit) ( 彈指瞬間 - 社群文章 ). . Retrieved October 5, 2009, from http://itgroup.blueshop.com.tw/moan/it_club?n=convew&i=12488.
Dear Sir
回覆刪除範例檔沒法下載,可以重新補放嗎?感謝您。
To Eric Tan,
刪除範例檔的部分就是寫在文章裡面的程式碼腳本
https://pulipulichen.github.io/blog-pulipuli-info-data-2020/04/autoit-virtualbox-installation/VirtualBoxSetup(pudding.20091005).au3
但這個腳本到了現在已經不能使用了
因為早期的VirtualBox安裝方式跟現在的VirtualBox安裝方式不一樣了,所以還是要修改才行
感恩,我研究一下,謝謝您。
回覆刪除To Eric Tan,
刪除有問題也可以發問喔,加油!