Sub imacros()
Dim iim1, iret
Set iim1 = CreateObject("imacros")
iret = iim1.iimInit("", True)
Dim macro
macro = "CODE:"
macro = macro + "'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database" + vbNewLine
macro = macro + "' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file" + vbNewLine
macro = macro + "'CSV = Comma Separated Values in each line of the filE" + vbNewLine
macro = macro + "TAB T=1" + vbNewLine
macro = macro + "SET !DATASOURCE C:\Users\Desktop\test\test.csv" + vbNewLine
macro = macro + "'Start at line 2 to skip the header in the file" + vbNewLine
macro = macro + "'Increase the current position in the file with each loop " + vbNewLine
macro = macro + "' Fill web form " + vbNewLine
macro = macro + "TAB T=1" + vbNewLine
macro = macro + "TAB CLOSEALLOTHERS" + vbNewLine
macro = macro + "SET !PLAYBACKDELAY 0.2" + vbNewLine
macro = macro + "URL GOTO=secured URL here" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:name CONTENT={{!COL1}}" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:SUBMIT ATTR=TYPE:submit" + vbNewLine
macro = macro + "TAG POS=1 TYPE=TABLE ATTR=CLASS:standardTable EXTRACT=TXT" + vbNewLine
macro = macro + "SAVEAS TYPE=EXTRACT FOLDER=""C:\Users\Desktop\test"" FILE=""test_image.csv""" + vbNewLine
macro = macro + "" + vbNewLine
iret = iim1.immPlay(macro)
End Sub
以上是我正在使用的代码。 有人可以告诉我,如果有什么问题和错误的原因? *使用iMacros Scripting Code Creator将代码从imacros转换为VBS字符串
答案 0 :(得分:0)
此行可能包含错误的引号:
macro = macro + "URL GOTO="secured URL here" + vbNewLine
您可以在此处看到,因为下一行标记为字符串:
macro = macro + "URL GOTO="secured URL here" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:name CONTENT={{!COL1}}" + vbNewLine
删除等号后的引号,然后重试。