PDA

View Full Version : Parsing %SB_RETURNEX%



CMS Software
12-19-2007, 02:53 PM
When I do a Subscription Key validity check, I then have access to the variable %_SB_RETURNEX%. However, it is in the format yyyymmdd followed by a CRLF. Can it be parsed inside the installer to get it into the format mm/dd/yyyy? I have not been able to find a SubString function inside SB6.

If not, I can grab %_SB_RETURNEX% during the SB install and place it in a registry key or INI file. My program exe can then parse it and place the result in another registry key or in the INI file under a different name. Now when my program needs to display the expiration date, it could read that from the registry key or ini file.

Any suggestions? :confused:

-O. D.-

linder
12-20-2007, 12:09 AM
Hello,

Yes, absolutely no problem. All the string functions are available in the "Handle String Function..." script function.

You can use the following to convert yyymmdd to mm/dd/yyyy

Set Variable %ORIGINAL_DATE% to "20071220"
Set Variable %YEAR% to FUNCTION:Left(%ORIGINAL_DATE%, 4)
Set Variable %MONTH% to FUNCTION:Mid(%ORIGINAL_DATE%, 2, 5)
Set Variable %DAY% to FUNCTION:Right(%ORIGINAL_DATE%, 2)
Set Variable %NEW_DATE% to "%MONTH%/%DAY%/%YEAR%"
Display Message Box "%NEW_DATE%" -- ""

Does this help?

Friedrich

CMS Software
12-20-2007, 09:51 PM
>Does this help?
>Friedrich

Does it ever. I kept looking in the "S" section for String actions. I've got to read through that entire list of functions and get familiar with what all is in there. Setup Builder comes through again! You have one amazing program here. I have reached the status of "True Believer" with regard to SB. Keep up the good work.

O. D. Williams

linder
12-22-2007, 03:58 AM
Thanks for your kind words :)

A Merry Christmas and a Happy New Year to you!

Friedrich

CMS Software
01-22-2008, 04:17 PM
Hello,

I did have to make a small adjustment to your suggested code because my date is coming from the function "Verify Subscription Key". Specifically, to the last line that sets the Variable %DAY% to FUNCTION:Right(%_SB_ReturnEX %, 2). On the right side of the _SB_ReturnEX variable there is a graphics character. Using the "Right" function pulls in that graphic character. I changed the Day line to read:
Set Variable %DAY% to FUNCTION:Mid(%_SB_ReturnEX %, 2,7)

Now it works as expected. Since you have referenced this post to others who had questions about Subscription Key expire dates, I thought I had better post the fix. The example you posted works because you definded you own date string. However, when the Date String is %_SB_RETURNEX% from the Verify Subscription Key function, there is an extra graphics character to deal with.

-O. D. Williams-

linder
01-23-2008, 03:57 AM
Hello,

Yes, the Subscription Key %_SB_RETURNEX% variable value holds two *list items* containing the expiration date and expiration version of the subscription key.

For example:

20080131|6.7.0.0

The above expires on 31-Jan-2008 -or- if version 6.7.0.1 or later is available.

Another option to handle this is to use the "Handle String Function (Get List Item)" script function to get the expiration date out of %_SB_RETURNEX%. List Item #1 would return the date, List Item #2 would return the expiration version (if used).

I'll add this to the documentation.

Thanks,
Friedrich