!NOW without leading zero does not work
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
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
-
- Posts: 1
- Joined: Fri Apr 16, 2010 11:56 am
!NOW without leading zero does not work
On http://wiki.imacros.net/!NOW it is said, that i can use {{!NOW:s}} to "Displays the second as a number without leading zeros"
So, the very simple macro:
PROMPT {{!NOW:s}}
should prompt something like:" 9 - ok"
but it always prompt " s - ok"
PROMPT {{!NOW:ss}}
works well - but I need the seconds without the leading zero - becouse it will be the line of a datasource...
Its the same issue with days and so on - everything without leading zeros does not work.
I am using Firefox 3.6.3 and iMacros 6.6.5.0
Any workarounds or fixes?
So, the very simple macro:
PROMPT {{!NOW:s}}
should prompt something like:" 9 - ok"
but it always prompt " s - ok"
PROMPT {{!NOW:ss}}
works well - but I need the seconds without the leading zero - becouse it will be the line of a datasource...
Its the same issue with days and so on - everything without leading zeros does not work.
I am using Firefox 3.6.3 and iMacros 6.6.5.0
Any workarounds or fixes?
-
- Posts: 1483
- Joined: Tue Jan 26, 2010 11:35 am
Re: !NOW without leading zero does not work
Hello,
Thanks a lot for reporting this! I could reproduce the issue here. I will now give it over to our developers, so that they fix it.
I hope the fix will be available soon!
Best regards,
Thanks a lot for reporting this! I could reproduce the issue here. I will now give it over to our developers, so that they fix it.
I hope the fix will be available soon!
Best regards,
Daniel, iOpus Support
Re: !NOW without leading zero does not work
Without leading zeros still does not work... and I see the wiki page now doesn't even reflect the 'without leading zeros' format code - http://wiki.imacros.net/!NOW... but the Google cached version does.
Is it not supported?
'm' and 'd' return the letters 'm' and 'd' respectively. Is there a workaround to get rid of the 0's, as 'mm' & 'dd' work, but I need without the leading zeros?
Thank you!
Is it not supported?
Code: Select all
VERSION BUILD=7031111 RECORDER=FX
SET !VAR1 {{!NOW:m}}
SET !VAR2 {{!NOW:d}}
SET !VAR3 {{!NOW:yyyy}}
Thank you!
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: !NOW without leading zero does not work
We updated the wiki page yesterday to reflect the fact that iMacros 7 (and iMacros for Firefox/Chrome) do not yet support
SET !VAR1 {{!NOW:m}}
SET !VAR2 {{!NOW:d}}
We are considering adding support for it to Version 7, but can you tell us why you need it? We want to make sure that we add the right features in the right way. So the question is, why is "s" better than "ss" in your use case?
SET !VAR1 {{!NOW:m}}
SET !VAR2 {{!NOW:d}}
We are considering adding support for it to Version 7, but can you tell us why you need it? We want to make sure that we add the right features in the right way. So the question is, why is "s" better than "ss" in your use case?
Re: !NOW without leading zero does not work
Thanks for the response.
I'm using it with a form submission macro. The site records the date as drop-down entries which do not include leading zeros. If imacros outputs leading zeros, the date isn't recognized and macros don't work.
This is a really crucial feature for my organization ASAP. Is there any workaround you can think of? Or if not, is there a possibility of feature support?
Thank you!!!
I'm using it with a form submission macro. The site records the date as drop-down entries which do not include leading zeros. If imacros outputs leading zeros, the date isn't recognized and macros don't work.
This is a really crucial feature for my organization ASAP. Is there any workaround you can think of? Or if not, is there a possibility of feature support?
Thank you!!!
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: !NOW without leading zero does not work
Are you using the iMacros Scripting Edition? If so, I can suggest a few workarounds.
Re: !NOW without leading zero does not work
Currently firefox addon, no scripting.
It's a pilot project with no funding as of yet. This set of macros would greatly improve the possibility of funding and wider implementation.
Can you please share scripting edition workarounds?
And what is the possibility of bringing back the 'm' & 'd' features?
It's a pilot project with no funding as of yet. This set of macros would greatly improve the possibility of funding and wider implementation.
Can you please share scripting edition workarounds?
And what is the possibility of bringing back the 'm' & 'd' features?
Last edited by cmuld3r on Tue Jan 25, 2011 10:33 pm, edited 1 time in total.
Re: !NOW without leading zero does not work
Can anyone please suggest a Javascript workaround to insert a month and day without leading zeros?
This is the current code (which doesn't work when the month and/or day have a leading zero, as I explained earlier... the site's drop-down selections don't have the leading zeros):
Thank you!
This is the current code (which doesn't work when the month and/or day have a leading zero, as I explained earlier... the site's drop-down selections don't have the leading zeros):
Code: Select all
VERSION BUILD=7031111 RECORDER=FX
SET !VAR1 {{!NOW:mm}}
SET !VAR2 {{!NOW:dd}}
SET !VAR3 {{!NOW:yyyy}}
'SET MONTH
TAG POS=1 TYPE=SELECT ATTR=NAME:litmonth CONTENT=%{{!VAR1}}
'SET DAY
TAG POS=1 TYPE=SELECT ATTR=NAME:litday CONTENT=%{{!VAR2}}
'SET YEAR
TAG POS=1 TYPE=SELECT ATTR=NAME:lityear CONTENT=%{{!VAR3}}
Thank you!
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: !NOW without leading zero does not work
StripZerosFromDate.js:
Code: Select all
var macroExtractDate;
macroExtractDate = "CODE:";
macroExtractDate += "ADD !EXTRACT {{!NOW:mm}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:dd}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:yyyy}}" + "\n";
iimPlay(macroExtractDate)
var month = parseInt(iimGetLastExtract(1));
var day = parseInt(iimGetLastExtract(2));
var year = parseInt(iimGetLastExtract(3));
var macroSetDate;
macroSetDate = "CODE:";
macroSetDate += "'SET MONTH" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:litmonth CONTENT=%{{month}}" + "\n";
macroSetDate += "'SET DAY" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:litday CONTENT=%{{day}}" + "\n";
macroSetDate += "'SET YEAR" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:lityear CONTENT=%{{year}}" + "\n";
iimSet("month", month.toString());
iimSet("day", day.toString());
iimSet("year", year.toString());
iimPlay(macroSetDate);
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: !NOW without leading zero does not work
Thank you Tom! Works great!
To play the js script you gave, I set up a js file which calls a macro with the first section of the original macro, plays the date setting javascript, then plays a macros with the last part of the original macro, repeating when necessary:
MYJSMACRO.js:
It would be easier for setup and editing to modify the function of the macro in one file, calling the set javascript where needed, rather than having multiple macros called from the js file which each contain parts of a complete macro and javascript inserted where needed.
Can javascript/js files be played from a macro? Or can macro code be placed in js files?
Or is there an easier way to do it that I'm not thinking of?
Thank you again!!!
update: I found the code creator which will convert macro code to javascript and other languages and vice versa (http://sourceforge.net/apps/trac/imacros-codegen). Is this my best bet? Any other possible solutions are still welcome
Thanks to all!
To play the js script you gave, I set up a js file which calls a macro with the first section of the original macro, plays the date setting javascript, then plays a macros with the last part of the original macro, repeating when necessary:
MYJSMACRO.js:
Code: Select all
iimPlay("STARTSERVICE.iim");
var macroExtractDate;
...
iimPlay(macroSetDate);
iimPlay("SERVICE1.iim");
iimPlay("SUBMITSERVICE.iim");
iimPlay("STARTSERVICE.iim");
var macroExtractDate;
...
iimPlay(macroSetDate);
iimPlay("SERVICE2.iim");
iimPlay("SUBMITSERVICE.iim");
Can javascript/js files be played from a macro? Or can macro code be placed in js files?
Or is there an easier way to do it that I'm not thinking of?
Thank you again!!!
update: I found the code creator which will convert macro code to javascript and other languages and vice versa (http://sourceforge.net/apps/trac/imacros-codegen). Is this my best bet? Any other possible solutions are still welcome
Thanks to all!
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: !NOW without leading zero does not work
You can only call macro code/files from Javascript, not the other way around.Can javascript/js files be played from a macro? Or can macro code be placed in js files?
Yes, that is a great tool for working with iMacros and script, definitely use it!I found the code creator... Is this my best bet?
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: !NOW without leading zero does not work
Thank you for all the help. The given code was working beautifully until yesterday (2/8/11) when the output of {{day}} started coming up as '0'. Strange why it would occur on 2/8/11...
Please test the following date macro if you are also now getting '0' output for the day (the test goes to wikipedia and puts the date - month day year [supposedly without leading zeros] into the search box with spaces between):
Please advise!
Please test the following date macro if you are also now getting '0' output for the day (the test goes to wikipedia and puts the date - month day year [supposedly without leading zeros] into the search box with spaces between):
Code: Select all
var macroExtractDate;
macroExtractDate = "CODE:";
macroExtractDate += "ADD !EXTRACT {{!NOW:mm}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:dd}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:yyyy}}" + "\n";
iimPlay(macroExtractDate)
var month = parseInt(iimGetLastExtract(1));
var day = parseInt(iimGetLastExtract(2));
var year = parseInt(iimGetLastExtract(3));
var macroSetDate;
macroSetDate = "CODE:";
macroSetDate += "URL GOTO=http://en.wikipedia.org/wiki/Main_Page" + "\n";
macroSetDate += "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/w/index.php ATTR=ID:searchInput CONTENT={{month}}<SP>{{day}}<SP>{{year}}" + "\n";
iimSet("month", month.toString());
iimSet("day", day.toString());
iimSet("year", year.toString());
iimPlay(macroSetDate);
Last edited by cmuld3r on Thu Feb 10, 2011 11:44 pm, edited 1 time in total.
-
- Posts: 3834
- Joined: Mon May 31, 2010 4:59 pm
Re: !NOW without leading zero does not work
Ah, sorry about that cmuld3r. It's because the parseInt function assumes the radix is octal (base eight) if the string begins with "0". To correct this, we just specify a radix of 10 in the calls to parseInt.
Code: Select all
var month = parseInt(iimGetLastExtract(1), 10);
var day = parseInt(iimGetLastExtract(2), 10);
var year = parseInt(iimGetLastExtract(3), 10);
Regards,
Tom, iMacros Support
Tom, iMacros Support
Re: !NOW without leading zero does not work
Thanks!
Here's the updated javascript code to set the date without leading zeros for anyone who needs it:
Here's the updated javascript code to set the date without leading zeros for anyone who needs it:
Code: Select all
//SET TODAY'S DATE
var macroExtractDate;
macroExtractDate = "CODE:";
macroExtractDate += "ADD !EXTRACT {{!NOW:mm}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:dd}}" + "\n";
macroExtractDate += "ADD !EXTRACT {{!NOW:yyyy}}" + "\n";
iimPlay(macroExtractDate)
var month = parseInt(iimGetLastExtract(1), 10);
var day = parseInt(iimGetLastExtract(2), 10);
var year = parseInt(iimGetLastExtract(3), 10);
var macroSetDate;
macroSetDate = "CODE:";
macroSetDate += "'SET MONTH" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:litmonth CONTENT=%{{month}}" + "\n";
macroSetDate += "'SET DAY" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:litday CONTENT=%{{day}}" + "\n";
macroSetDate += "'SET YEAR" + "\n";
macroSetDate += "TAG POS=1 TYPE=SELECT ATTR=NAME:lityear CONTENT=%{{year}}" + "\n";
iimSet("month", month.toString());
iimSet("day", day.toString());
iimSet("year", year.toString());
iimPlay(macroSetDate);