2
我使用imacro的概念自動填寫表格。我記錄了一個並獲得了劇本。imacro自動填寫表格
對於如: -
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=http://mysite/home.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:home.aspx ATTR=ID:ContentPlaceHolder1_txtUsername CONTENT=samual
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:home.aspx ATTR=ID:ContentPlaceHolder1_txtPassword CONTENT=sampassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:ContentPlaceHolder1_btnLogin
TAG POS=1 TYPE=A ATTR=ID:ContentPlaceHolder1_bpo_TabContainer_tbpnl_lnk_address_0
TAG POS=1 TYPE=INPUT:IMAGE FORM=ID:form1 ATTR=ID:Logout
但我的實際需求是點擊一個按鈕,我需要執行這個宏,每次表單字段值可能變動。所以我需要動態地將這些新值傳遞給宏。我想單擊那個按鈕,我會傳遞新值給這些腳本並保存這個宏並調用這個宏。但是我不確定它是如此工作的方式,還是可以從使用iMacro創建的程序調用宏(如上所述)?
感謝
感謝很多答案。它給了一些見解。但你能解釋一下嗎?因爲我對imacro概念完全陌生。
<html>
<body>
<script type="text/javascript">
function runimacros() {
var iim1 = new ActiveXObject("imacros");
var ret
ret = iim1.iimInit("-fx");
ret = iim1.iimDisplay("Test Macro");
ret = iim1.iimPlay ("testmacro.iim");//this is the macro which I created in firefox and located C:\Users\MyName\Documents\iMacros\Macros\testmacro.iim
ret = iim1.iimExit();
}
</script>
<a href="javascript:runimacros()">Click to run iMacros</font></a>
</body>
</html>
請注意,創建(testmacro.iim)的宏使用的是firefox,它位於上述位置。
我嘗試了'http://wiki.imacros.net/JavaScript'的方法,但不起作用。我錯過了什麼嗎?我在Visual Studio中嘗試了上面的代碼,並將默認瀏覽器設置爲IE。請給出任何建議。
感謝