Tweety wrote:De regel die ik wil veranderen is
TAG POS=1 TYPE=IMG ATTR=SRC:
https://sis.hva.nl:8011/cs/S2PRD/cache/PT_ADD_DUT_1.gif (dit is een knop die het veld oplust(+))
Als ik nu de macro uitvoer dan vult hij automatisch een datum (Actiedatum) in en het nummer (Nr. studieactiv.) uit het txt bestand. vervolgens drukt hij op het + teken. Nu wil dat de macro niet het plusteken gebruikt als er geen nieuwe regel in txt bestand voorkomt.
De regels zijn die in het txt bestand staan varieren tussen 5 en 20
OK, now I understand, thanks for the clarification. And a Screenshot with visual Indicators is indeed always the best explanation...
I will first (freely) re-translate your Reply in English:
Tweety wrote:The Line I want to modify (once the end of the .CSV File has been reached) is:
TAG POS=1 TYPE=IMG ATTR=SRC:
https://sis.hva.nl:8011/cs/S2PRD/cache/PT_ADD_DUT_1.gif
(It's a '+' sign adding a new Row.)
The Macro fills in automatically a Date (Actiedatum) and a Number (Nr. studieactiv.) from the .CSV File and then clicks on the '+' sign. Now I want that the Macro doesn't click on the + sign if there is no new Row of Data in the .CSV File.
There are between 5 and 20 Rows in the .CSV File
OK, I think the easiest way to achieve what you want is to move the Line clicking on the '+' sign from the end of your Macro to the beginning and make sure that it is not executed on the 1st Run of your Looping.
I don't see any '!ERRORIGNORE' Statement in your Script, so I assume that you either type in the exact Number for MAX_LOOP corresponding to the Number of Rows in your .CSV File or that you always select a bigger Number and you wait for the Runtime Error to occur once the end of the .CSV has been reached.
If you always type in a bigger Number, that means that you want to check BEFORE clicking on the '+' sign if the (new) Row in the .CSV File contains valid Data.
And your Script will look like this:
Code: Select all
VERSION BUILD=8031994
'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database
TAB T=1
TAB CLOSEALLOTHERS
' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
'CSV = Comma Separated Values in each line of the file
SET !DATASOURCE C:\1Bulkinschrijvingensamenvoegen.txt
'Start at line 2 to skip the header in the file
SET !LOOP 1
'Increase the current position in the file with each loop
SET !DATASOURCE_LINE {{!LOOP}}
'Check if valid Row of Data in .CSV File:
'(Triggers Runtime Error if end of .CSV File has been reached.)
SET !VAR1 {{!COL1}}
' Fill web form
'Click on '+' sign except on 1st Run of Looping:
'=> 'plus=0' for 1st Run, 'plus=1' for all others:
SET plus EVAL("var d=\"{{!LOOP}}\"; if (d<2) {var x=0;} else {var x=1;} x;")
'For Debugging (Uncomment to activate):
'PROMPT !LOOP:<SP>{{!LOOP}}<br>plus:<SP>{{plus}}<br>!COL1:<SP>{{!COL1}}
FRAME NAME="TargetContent"
TAG POS={{plus}} TYPE=IMG ATTR=SRC:https://sis.hva.nl:8011/cs/S2PRD/cache/PT_ADD_DUT_1.gif
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:BLK_ENR_CRS_TMP_ENRL_ACTION_DT$0 CONTENT=03-03-2014
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:win0 ATTR=ID:BLK_ENR_CRS_TMP_CLASS_NBR$0 CONTENT ={{!COL1}}
'TAG POS=1 TYPE=IMG ATTR=SRC:https://sis.hva.nl:8011/cs/S2PRD/cache/PT_ADD_DUT_1.gif
You are allowed to have 0 or 1 empty Row (= 0 or 1 Carriage Return) at the end of your .CSV File, if you have more, they will be treated like valid Rows with empty Data.
And a funny detail: I worked once for 1 year for the HVA (20 years ago).
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...