Thank you very much for your valuable help. I've run the script in the past two days
He worked well, by adding
Code: Select all
SET !ERRORIGNORE yes
SET !TIMEOUT_STEP 5
Now imacros ignore when the appointment if it not available and try again, awesome !!
I wonder if i can select a day range in SET?
Code: Select all
SET Pref_Date "2018-07-13"
SET Pref_Time "11"
like tell imacros to pick any available date between
2018-07-18 and
2018-07-29 and pick any available time between 11 and 15?
So I ran the script in the past two days.. checked yesterday and no appointment booked ... I reviewed the script many times and maybe there was something wrong but I did not find anything, especially as it ignored errors...
I discovered that there a final missing page .. it only shows up when people start booking, so i choise the script to book "2018-07-13" but people booked before me and all slots is full .... didn't think at that before
I believe that this is the code :
Code: Select all
var dt4 = '2018-07-09';
var blocked_dates = ["28-12-2017","29-12-2017","01-01-2018","30-03-2018","02-04-2018","01-05-2018","01-06-2018","15-08-2018","12-10-2018"];
var available_dates = ["16-07-2018","17-07-2018","18-07-2018","19-07-2018","20-07-2018","23-07-2018","25-07-2018","26-07-2018"];
var fullCapicity_dates = ["09-07-2018","10-07-2018","11-07-2018","12-07-2018","13-07-2018",];
var offDates_dates = ["14-07-2018","15-07-2018","21-07-2018","22-07-2018","24-07-2018","28-07-2018","29-07-2018"];
Now the date "
2018-07-13" is in "
var fullCapicity_dates" so it's booked
this is the full source
Code: Select all
<script type="text/javascript">
var today = new Date();
var dd = today.getDate()+1;
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10){
dd='0'+dd
}
if(mm<10){
mm='0'+mm
}
var today = yyyy+'-'+mm+'-'+dd;
function formatDate(rawDate) {
var day = ("0" + rawDate.getDate()).slice(-2);
var month = ("0" + (rawDate.getMonth() + 1)).slice(-2);
return (day)+ "-" + (month)+ "-" +rawDate.getFullYear() ;
}
$(document).ready(function() {
var dt1 = '2018-07-08';
$('.date_of_birth').datepicker({
format: "yyyy-mm-dd",
endDate: new Date(dt1),
startDate: '-100y',
autoclose: true,
startView: 2
});
$('.pptIssueDate').datepicker({
format: "yyyy-mm-dd",
endDate: new Date(dt1),
startDate: '-100y',
autoclose: true,
startView: 2
});
$('.passport_validate_till').datepicker({
format: "yyyy-mm-dd",
startDate: new Date(dt1),
autoclose: true,
startView: 2
});
var dt4 = '2018-07-09';
var blocked_dates = ["28-12-2017","29-12-2017","01-01-2018","30-03-2018","02-04-2018","01-05-2018","01-06-2018","15-08-2018","12-10-2018"];
var available_dates = ["13-07-2018","16-07-2018","17-07-2018","18-07-2018","19-07-2018","20-07-2018","23-07-2018","25-07-2018","26-07-2018"];
var fullCapicity_dates = ["09-07-2018","10-07-2018","11-07-2018","12-07-2018"];
var offDates_dates = ["14-07-2018","15-07-2018","21-07-2018","22-07-2018","24-07-2018","28-07-2018","29-07-2018"];
$('.app_date').datepicker({
language: "en",
Default: true,
format: "yyyy-mm-dd",
startDate: new Date(dt4),
endDate: '2018-12-31',
autoclose: true,
forceParse:true,
startView: 0,
beforeShowDay: function(date){
var formattedDate = formatDate(date);
if ($.inArray(formattedDate.toString(), blocked_dates) != -1){
return {
enabled : false,
classes: 'inactiveClass',
tooltip: 'Holiday'
};
}
if ($.inArray(formattedDate.toString(), available_dates) != -1){
return {
enabled : true,
classes: 'activeClass',
tooltip: 'Book'
};
}
if ($.inArray(formattedDate.toString(), fullCapicity_dates) != -1){
return {
enabled : false,
classes: 'fullcap',
tooltip: 'Slots Full'
};
}
if ($.inArray(formattedDate.toString(), offDates_dates) != -1){
return {
enabled : false,
classes: 'offday',
tooltip: 'Off Day'
};
}
return {
enabled : false,
tooltip: 'Not Allowed'
};
return;
}
});
$("#app_date").datepicker("setDate", '2016-09-16');
});
</script>
</div>
So i recorded again to choise "16-07-2018" from "var available_dates"
Because i need a new script for this new page
This is the automatic mode :
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:app_date
TAG POS=2 TYPE=TD ATTR=TXT:16
But when i play it it does not choise it and i get this error :
Code: Select all
Error -1300: Cannot find HTML element of type "TD:" with attribute(s) "TXT:27".. Line 7: TAG POS=2 TYPE=TD ATTR=TXT:27
i tried this :
I start recording choising the date
"2018-07-18" then i went back and choise
"2018-07-27"
To see if there is any change
but nothing new in the automatic mode
I change the recording mode to complete HTML
and i noticed a change, SOMETHING NEW !!
"CONTENT=2018-07-18"
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:app_date
TAG POS=1 TYPE=TD ATTR=TXT:18
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:app_date CONTENT=2018-07-18
TAG POS=2 TYPE=TD ATTR=TXT:27
and yeeeeees by playing :
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:app_date
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:app_date CONTENT=2018-07-27
It's working
Ok i feel like i'm very smart right now
And by combinnig the code from automatic and html mode, wow great ideas
Now i want run 2 script the first one with day range and last one also with day range
But i want to twist this final code to also do a days range to pick any date Between
17-07 and
26-07 in
var available_dates and skip the first 2 date (
16-07 and
17-07) ?