Sample imacro code:
Code: Select all
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeHH CONTENT=%HH
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeMM CONTENT=%MM
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeAMPM CONTENT=%AMorPM
Code: Select all
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeHH CONTENT=%HH
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeMM CONTENT=%MM
TAG POS=1 TYPE=SELECT ATTR=ID:ScheduleTimeAMPM CONTENT=%AMorPM
Code: Select all
if (min >57) {hour = hour + 1;}
Code: Select all
//SET TIME
//var macroExtractTime;
//macroExtractTime = "CODE:";
//macroExtractTime += "ADD !EXTRACT {{!NOW:hh}}" + "\n";
//macroExtractTime += "ADD !EXTRACT {{!NOW:nn}}" + "\n";
//iimPlay(macroExtractTime)
//var hour = (iimGetLastExtract(1));
//var min = (iimGetLastExtract(2));
//var ampm = "AM";
var hour = "10";
var min = "58";
var ampm = "AM";
//ROUND TO NEAREST 5 MIN
var mm1 = min%5; // remainder after division
var mm2 = (parseInt(min/5)); //units of 5 minutes
if (mm1 <=2) {min = mm2*5} //0-2 minutes
else {min = mm2*5+5} //3-4 minutes
if (min >57) {min = "0";}
if (min >57) {hour = hour + 1;}
//AM-PM
if (hour > 11) {ampm = "PM";}
if (hour > 12) {hour = hour - 12;}
if (hour == 0) {hour = 12;}
//Add 0 to less than 10
if (hour < 10) { hour= "0" + hour;}
if (min < 10) { min = "0" + min;}
iimSet("hour", hour.toString());
iimSet("min", min.toString());
iimSet("ampm", ampm.toString());
var macroSetTime;
macroSetTime = "CODE:";
macroSetTime += "URL GOTO=http://en.wikipedia.org/wiki/Main_Page" + "\n";
macroSetTime += "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/w/index.php ATTR=ID:searchInput CONTENT={{hour}}:{{min}}<SP>{{ampm}}" + "\n";
iimPlay(macroSetTime)
Code: Select all
if (min >57) {min = 0;}
if (min >57) {hour = hour + 1;}
Code: Select all
alert(min);
alert(hour);
if (min >57) {min = 0;}
if (min >57) {hour = hour + 1;}
alert(min);
alert(hour);
Code: Select all
var hour = 10;
var min = 58;
var ampm = "AM";
//ROUND TO NEAREST 5 MIN
var mm1 = min%5; // remainder after division
var mm2 = (parseInt(min/5)); //units of 5 minutes
if (mm1 <=2) {min = mm2*5} //0-2 minutes
else {min = mm2*5+5} //3-4 minutes
if (min >57) {hour = hour + 1;}
if (min >57) {min = 0;}
//AM-PM
if (hour > 11) {ampm = "PM";}
if (hour > 12) {hour = hour - 12;}
if (hour == 0) {hour = 12;}
//Add 0 to less than 10
if (hour < 10) { hour= "0" + hour;}
if (min < 10) { min = "0" + min;}
iimSet("hour", hour.toString());
iimSet("min", min.toString());
iimSet("ampm", ampm.toString());
var macroSetTime;
macroSetTime = "CODE:";
macroSetTime += "URL GOTO=http://en.wikipedia.org/wiki/Main_Page" + "\n";
macroSetTime += "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/w/index.php ATTR=ID:searchInput CONTENT={{hour}}:{{min}}<SP>{{ampm}}" + "\n";
iimPlay(macroSetTime)
Code: Select all
//SET TIME
var macroExtractTime;
macroExtractTime = "CODE:";
macroExtractTime += "ADD !EXTRACT {{!NOW:hh}}" + "\n";
macroExtractTime += "ADD !EXTRACT {{!NOW:nn}}" + "\n";
iimPlay(macroExtractTime)
var hour = (iimGetLastExtract(1));
var min = (iimGetLastExtract(2));
var ampm = "AM";
//ROUND TO NEAREST 5 MIN
var mm1 = min%5; // remainder after division
var mm2 = (parseInt(min/5)); //units of 5 minutes
if (mm1 <=2) {min = mm2*5} //0-2 minutes
else {min = mm2*5+5} //3-4 minutes
if (min >57) {hour = hour + 1;}
if (min >57) {min = "0";}
//AM-PM
if (hour > 11) {ampm = "PM";}
if (hour > 12) {hour = hour - 12;}
if (hour == 0) {hour = 12;}
//Add 0 to less than 10
if (hour < 10) { hour= "0" + hour;}
if (min < 10) { min = "0" + min;}
iimSet("hour", hour.toString());
iimSet("min", min.toString());
iimSet("ampm", ampm.toString());
var macroSetTime;
macroSetTime = "CODE:";
macroSetTime += "URL GOTO=http://en.wikipedia.org/wiki/Main_Page" + "\n";
macroSetTime += "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/w/index.php ATTR=ID:searchInput CONTENT={{hour}}:{{min}}<SP>{{ampm}}" + "\n";
iimPlay(macroSetTime)