/build/static/layout/Breadcrumb_cap_w.png

Getting the LENGTH of a string entered by a user

Greetings all!

I'm creating an install here (MSI) which needs to gather some info from the tech doing the install. No sweat so far.

Actually, I'm repackaging an app called Cashier for Windows - it's actually a current app, but they're still using some OLD conventions: their install exe is InstallShield 3; they actually use a dir off the root of c:, etc.)

However, not only can't the user input exceed 4 characters (and yes, I know how to set the Max Characters limitation), if the input is LESS than 4 characters, their native installer PADS the value so that it IS 4 characters - padded with underscores.

For example, if the user enters "ABC" - then their installer uses "ABC_" - argh.

So my actual questions are:

1) How can I check the LENGTH of a user entered string, and
2) How do a reset the property to reflect the padding (I'm thinking it'll be MSISetProperty).

If you know the answer, might you also know how to do other string handling ike I USED to to in the expression parser for WiseScript (Len, Left$, InStr, etc.)?

Thanks in advance,

- Sean Roberts

0 Comments   [ + ] Show comments

Answers (3)

Posted by: Robo Scripter 20 years ago
Orange Senior Belt
0
Sean,

You really need to explorer doing VB Script rather than this Wise Script stuff!

I admittedly have not tried setting a Property with the wise script objects since WFWI 3.5x. Frankly I got tired of the frustration, cause it never worked right.

VB Script is native to the installer, and runs quite well.

I would respectfully like to suggest that a copy of the, “Windows 2000 Scripting Guide”, needs to be in your next trip to Amazon.
At least down load the help repository;
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=B4CB2678-DAFB-4E30-B2DA-B8814FE2DA5A

Additionally you might like to down load the book "VB/VBA Developer's Guide to the Windows Installer"

Mike Gunderloy has posted his out-of-print book as a free download on his website. He says: "This is a book I did for Sybex, based on the 1.0 release of the Windows Installer. It didn't do especially well in the market, and the rights have reverted to me. So, if you want, you can download the uncorrected galleys and read it for free now. Out of date, but perhaps still useful."

http://www.larkware.com/InstallerBook.zip

I never understood why this book did not take off. At the time of its printing it was the only non –vendor specific Windows Installer book on the market. And in many ways still is. It is still to date the only readable book that I have found that has a good grasp of the basics needed to understand the workings of the MSI.

Good Luck

Regards,
Posted by: sean_c_roberts 20 years ago
Senior Purple Belt
0
Thanks for the reply.

I DO need to learn VB scripting, but I'm a Delphi coder as well, and SOMETIMES VB frustrates the hell out of me, compared to the visual pascal I'm used to.

I ended up using the Get and Set Windows Installer Property WiseScript actions - although, the Set action hasn;t worked for me yet.

Here's the code I used:

item: Custom Script Item
Filename=Get Windows Installer Property.wse
Variable Name1=_PROPERTYNAME_
Variable Value1=CURRENTLOCATION
Variable Name2=_PROP_VAR_
Variable Value2=CURRENTLOCATION
Variable Name3=HELPFILE
Variable Value3=C:\Program Files\Wise Package Studio\HELP\WiseScriptEditor.chm
end
item: If/While Statement
Value=Len(CURRENTLOCATION) = 1
Flags=00001101
end
item: Custom Script Item
Filename=Set Windows Installer Property.wse
Variable Name1=_PROPERTYNAME_
Variable Value1=CURRENTLOCATION
Variable Name2=HELPFILE
Variable Value2=C:\Program Files\Wise Package Studio\HELP\WiseScriptEditor.chm
Variable Name3=_PROPERTYVAL_
Variable Value3=%CURRENTLOCATION%___
end
item: End Block
end
item: If/While Statement
Value=Len(CURRENTLOCATION) = 2
Flags=00001101
end
item: Custom Script Item
Filename=Set Windows Installer Property.wse
Variable Name1=_PROPERTYNAME_
Variable Value1=CURRENTLOCATION
Variable Name2=HELPFILE
Variable Value2=C:\Program Files\Wise Package Studio\HELP\WiseScriptEditor.chm
Variable Name3=_PROPERTYVAL_
Variable Value3=%CURRENTLOCATION%__
end
item: End Block
end
item: If/While Statement
Value=Len(CURRENTLOCATION) = 3
Flags=00001101
end
item: Custom Script Item
Filename=Set Windows Installer Property.wse
Variable Name1=_PROPERTYNAME_
Variable Value1=CURRENTLOCATION
Variable Name2=HELPFILE
Variable Value2=C:\Program Files\Wise Package Studio\HELP\WiseScriptEditor.chm
Variable Name3=_PROPERTYVAL_
Variable Value3=%CURRENTLOCATION%_
end
item: End Block
end
Posted by: MSIMaker 20 years ago
2nd Degree Black Belt
0
VB Script is good......except there is no error checking or controls. So if it dont work.....take a shovel and dig :)
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ