Fill in datepicker from CSV file

Discussions and Tech Support specific to the iMacros for Chrome extension.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
abirchy
Posts: 6
Joined: Wed Feb 08, 2017 9:29 am

Fill in datepicker from CSV file

Post by abirchy » Wed Feb 08, 2017 9:41 am

Hello,

I am completely new to using iMacros and have had, so far, great success in having it automate some of my workload. I have come across a problem that I have not been so far able to find an answer for.

I am using iMacros to fill out forms for different clients from a CSV file. I have yet to understand how to input dates from the CSV into a datepicker field. Each client has a different date that needs to be put in. Here is the code for the field that I am trying to input the date into from the CSV file:

Code: Select all

<md-input-container ng-class="{'md-has-icon': amDatePicker.showInputIcon &&
                                                      (amDatePicker.showInputIcon || amDatePicker.allowClear) }" class="md-input-has-value md-has-icon">
            <label class="ng-binding" for="input_25">Enter date</label>
            <!-- ngIf: amDatePicker.showInputIcon --><div class="am-date-picker__calendar-icon ng-scope" ng-if="amDatePicker.showInputIcon">
                <button class="md-icon-button md-button md-ink-ripple" type="button" ng-transclude="" ng-click="amDatePicker.openPicker($event)" aria-label="Clear">
                   <!-- ngIf: amDatePicker.showInputIcon --><md-icon md-svg-icon="resources/vendors/am-date-picker/ic_today_24px.svg" ng-if="amDatePicker.showInputIcon" class="ng-scope" aria-hidden="true"><svg height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false">
    <path d="M0 0h24v24H0z" fill="none"></path>
    <path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"></path>
</svg></md-icon><!-- end ngIf: amDatePicker.showInputIcon -->
                <div class="md-ripple-container"></div></button>
            </div><!-- end ngIf: amDatePicker.showInputIcon -->
 
            <input ng-model="amDatePicker.modelMomentFormatted" ng-click="amDatePicker.openPicker($event)" class="am-date-picker__input ng-pristine ng-valid md-input ng-not-empty ng-touched" type="text" readonly="readonly" id="input_25" aria-invalid="false" style=""><div class="md-errors-spacer"></div>
            <!-- ngIf: amDatePicker.allowClear --><div class="am-date-picker__clear-icon ng-scope" ng-if="amDatePicker.allowClear">
                <button class="md-icon-button md-button md-ink-ripple" type="button" ng-transclude="" ng-click="amDatePicker.clearDate()" aria-label="Clear">
                    <md-icon md-svg-icon="resources/vendors/am-date-picker/ic_close_24px.svg" class="ng-scope" aria-hidden="true"><svg height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false">
    <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
    <path d="M0 0h24v24H0z" fill="none"></path>
</svg></md-icon>
                </button>
            </div><!-- end ngIf: amDatePicker.allowClear -->
        </md-input-container>
1. What version of iMacros are you using?
Chrome:844/8.4.4 & Firefox 9030808/9.0.3

2. What operating system are you using? (please also specify language)
Windows 7 32-bit

3. Which browser(s) are you using? (include version numbers)
Chrome 56.0.2924.87 & Firefox 51.0.1

4. Do the included demo macros work ok?
Yes

7. Do you encounter the same problem with the iMacros Browser, iMacros for Internet Explorer and iMacros for Firefox? Note: If your question is specifically about iMacros for Firefox or iMacros for Chrome, please use their sub-forums.
Yes

If I can clarify in anyway, please let me know. Thank you so much for your help!
Last edited by abirchy on Wed Feb 15, 2017 3:29 am, edited 2 times in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill in datepicker from CSV file

Post by chivracq » Wed Feb 08, 2017 1:59 pm

abirchy wrote:Hello,

I am completely new to using iMacros and have had, so far, great success in having it automate some of my workload. I have come across a problem that I have not been so far able to find an answer for.

I am using iMacros to fill out forms for different clients from a CSV file. I have yet to understand how to input dates from the CSV into a datepicker field. Each client has a different date that needs to be put in. Here is the code for the field that I am trying to input the date into from the CSV file:

Code: Select all

<md-input-container ng-class="{'md-has-icon': amDatePicker.showInputIcon &&
                                                      (amDatePicker.showInputIcon || amDatePicker.allowClear) }" class="md-input-has-value md-has-icon">
            <label class="ng-binding" for="input_25">Enter date</label>
            <!-- ngIf: amDatePicker.showInputIcon --><div class="am-date-picker__calendar-icon ng-scope" ng-if="amDatePicker.showInputIcon">
                <button class="md-icon-button md-button md-ink-ripple" type="button" ng-transclude="" ng-click="amDatePicker.openPicker($event)" aria-label="Clear">
                   <!-- ngIf: amDatePicker.showInputIcon --><md-icon md-svg-icon="resources/vendors/am-date-picker/ic_today_24px.svg" ng-if="amDatePicker.showInputIcon" class="ng-scope" aria-hidden="true"><svg height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false">
    <path d="M0 0h24v24H0z" fill="none"></path>
    <path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"></path>
</svg></md-icon><!-- end ngIf: amDatePicker.showInputIcon -->
                <div class="md-ripple-container"></div></button>
            </div><!-- end ngIf: amDatePicker.showInputIcon -->
 
            <input ng-model="amDatePicker.modelMomentFormatted" ng-click="amDatePicker.openPicker($event)" class="am-date-picker__input ng-pristine ng-valid md-input ng-not-empty ng-touched" type="text" readonly="readonly" id="input_25" aria-invalid="false" style=""><div class="md-errors-spacer"></div>
            <!-- ngIf: amDatePicker.allowClear --><div class="am-date-picker__clear-icon ng-scope" ng-if="amDatePicker.allowClear">
                <button class="md-icon-button md-button md-ink-ripple" type="button" ng-transclude="" ng-click="amDatePicker.clearDate()" aria-label="Clear">
                    <md-icon md-svg-icon="resources/vendors/am-date-picker/ic_close_24px.svg" class="ng-scope" aria-hidden="true"><svg height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false">
    <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
    <path d="M0 0h24v24H0z" fill="none"></path>
</svg></md-icon>
                </button>
            </div><!-- end ngIf: amDatePicker.allowClear -->
        </md-input-container>
If I can clarify in anyway, please let me know. Thank you so much for your help!
Oh..., you've added some Source Code to your Post, good, even if hum..., difficult to "use" it directly, it looks to me like it is the Source BEFORE selecting any Date, would need the Source as well AFTER selecting a Date (if it changes...!).
More handy would be if you could post the URL or find some similar Site/Page if your Site is behind Login&Password...

Willing to have a look at your Case if you mention your FCI which is Required Info to include in your OP when you open a Thread or post for the first time in some existing Thread, read my Sig, many Commands are not implemented for all Browsers/Versions...

Handy as well would be if you can post what iMacros will record in Standard 'TAG' Mode when filling in some Date?
+ In which Format do you keep the Dates in your DataSource...?
+ Post what iMacros records using the 'EVENT' Mode (if the 'EVENT' Mode is supported in your Version, depending on your FCI...!) when filling in some Date, maybe for 2 different Dates (mention which ones if it's not clear from the Recording)...?

>>>

And mini-Remark: Posting in the 'iMacros for CR' Sub-Forum means that your Pb is specific to only CR and that your Script already works in IE/iMB/FF, which I reckon is not the case here..., the 'General' Sub-Forum would have been more appropriate... (But no need to duplicate your Thread..., this is then Spam, and your Thread can always be moved...)
- (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...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Fill in datepicker from CSV file

Post by iimfun » Thu Feb 09, 2017 8:10 am

Test out the macro below. I believe that your solution can be similar.

Code: Select all

SET dateCsvColumn "02/09/2017"
TAB OPEN
TAB T=2
URL GOTO=https://jqueryui.com/datepicker/
FRAME F=1
EVENT TYPE=CLICK SELECTOR="#datepicker" BUTTON=0
SET !REPLAYSPEED MEDIUM
EVENTS TYPE=KEYPRESS SELECTOR="#datepicker" CHARS={{dateCsvColumn}}
EVENT TYPE=KEYPRESS SELECTOR="#datepicker" KEY=27
abirchy
Posts: 6
Joined: Wed Feb 08, 2017 9:29 am

Re: Fill in datepicker from CSV file

Post by abirchy » Tue Feb 14, 2017 12:51 am

The datepicker is based on this http://codepen.io/fdooch/pen/KzWWRG. Hope that helps. I will update with more info shortly. Sorry, I've just been really busy.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill in datepicker from CSV file

Post by chivracq » Tue Feb 14, 2017 4:04 am

abirchy wrote:The datepicker is based on this http://codepen.io/fdooch/pen/KzWWRG. Hope that helps. I will update with more info shortly. Sorry, I've just been really busy.
OK but I will only have a look once you'll have mentioned your FCI (at the top of your OP) + mini-Bump or I won't notice your Update..., + answer my Qt about the Format in your '.CSV' File, and I would like to know what you've tried and where exactly you get stuck...? (As I (only) help Users who really get stuck after they've tried their best but I don't write their Script and you didn't post any Script...)

And would be nice if you could try/test @iimfun's Script, it's no use I go digging into your Case if his Script works directly... :idea:
- (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...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Fill in datepicker from CSV file

Post by iimfun » Tue Feb 14, 2017 9:18 am

The solution seems to be extremely simple

Code: Select all

SET dateCsvColumn "14.02.2017"
FRAME NAME="CodePen"
TAG XPATH="id('input_2')" CONTENT={{dateCsvColumn}}
abirchy
Posts: 6
Joined: Wed Feb 08, 2017 9:29 am

Re: Fill in datepicker from CSV file

Post by abirchy » Wed Feb 15, 2017 2:30 am

iimfun wrote:The solution seems to be extremely simple

Code: Select all

SET dateCsvColumn "14.02.2017"
FRAME NAME="CodePen"
TAG XPATH="id('input_2')" CONTENT={{dateCsvColumn}}

Code: Select all

TAG POS=2 TYPE=DIV ATTR=CLASS:md-off&&TXT:
TAG POS=3 TYPE=DIV ATTR=CLASS:md-off&&TXT:
TAG XPATH="id('input_7')" CONTENT={{!COL12}}
TAG XPATH="id('input_8')" CONTENT={{!COL13}}
I tried this variation of the sample you gave me. The datepicker acts as if there was no date input into those boxes.
abirchy
Posts: 6
Joined: Wed Feb 08, 2017 9:29 am

Re: Fill in datepicker from CSV file

Post by abirchy » Wed Feb 15, 2017 2:49 am

chivracq wrote:
abirchy wrote:The datepicker is based on this http://codepen.io/fdooch/pen/KzWWRG. Hope that helps. I will update with more info shortly. Sorry, I've just been really busy.
OK but I will only have a look once you'll have mentioned your FCI (at the top of your OP) + mini-Bump or I won't notice your Update..., + answer my Qt about the Format in your '.CSV' File, and I would like to know what you've tried and where exactly you get stuck...? (As I (only) help Users who really get stuck after they've tried their best but I don't write their Script and you didn't post any Script...)

And would be nice if you could try/test @iimfun's Script, it's no use I go digging into your Case if his Script works directly... :idea:

I'm truly sorry for the delay. I should have read the forum rules and double checked my post before I posted.

I updated with the FCI in the OP and I have tried iimfun scripts (thank you so much iimfun for your help). I've additionally tried to run a userscript on the site to allow me just to go ahead and type the date in from my CSV with no luck. My CSV stores the date in a MM/DD/YYYY format. I think the issue is being able to read the date in the CSV and then relating that into steps the macro should take to input the date as (if that makes sense). I can provide a test account for the site as it is publicly accessible site, I would just have to send it as a personal message for some security. The conventional recording method records this

Code: Select all

TAG POS=5 TYPE=BUTTON ATTR=TXT:
TAG POS=1 TYPE=BUTTON ATTR=TXT:January<SP>2017
TAG POS=1 TYPE=BUTTON ATTR=TXT:2015
TAG POS=1 TYPE=BUTTON ATTR=TXT:23
TAG POS=1 TYPE=BUTTON ATTR=TXT:OK
Thank you again so much for your help!
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Fill in datepicker from CSV file

Post by iimfun » Wed Feb 15, 2017 8:06 am

abirchy wrote:The datepicker acts as if there was no date input into those boxes.
It sounds unclear (at least for me).

I can have a look at your site. Post some mail for personal messages.
abirchy
Posts: 6
Joined: Wed Feb 08, 2017 9:29 am

Re: Fill in datepicker from CSV file

Post by abirchy » Fri Feb 17, 2017 2:03 am

You can get hold of me at dasabir424@gmail.com
Post Reply