Page 1 of 1

Start Menu Group and Program Files path allowing illegal Windows characters

Posted: Thu Oct 01, 2020 2:44 am
by dileep.tiwari
Hi,
I am just doing some R&D and i found StartMenu and ProgramFIles path are allowing users to enter Illegal character for eg.
find attached startmenu.jpg and programfiles.jpg
i dont want to allow user to put any illegal characters to either startmenu or in programfiles path.
if anybody enters illegal characters in startmenu or in programfiles path NEXT button should be disabled.(NEXT button only enables if all entered characters are legal)
it there any way to achieve this. does installaware provide this functionality.

Thanks,
Dileep

Re: Start Menu Group and Program Files path allowing illegal Windows characters

Posted: Thu Oct 01, 2020 12:16 pm
by FrancescoT
You may use the "Parse String" script command for that.
The command parses a string by a given pattern or position index and splits the result into two new strings.


Then you can use the returned strings to validate your path.

Re: Start Menu Group and Program Files path allowing illegal Windows characters

Posted: Thu Oct 01, 2020 12:46 pm
by dileep.tiwari
Can i get any example sample if it is available.

Re: Start Menu Group and Program Files path allowing illegal Windows characters

Posted: Fri Oct 02, 2020 10:40 am
by FrancescoT
No, there isn't a specific sample available.
...let me see if I still have one.

Re: Start Menu Group and Program Files path allowing illegal Windows characters

Posted: Wed Oct 07, 2020 10:09 am
by FrancescoT
With the help of the "Match Regular Expression" script command, it's really a simple matter.

For example:

Set Variable MYPATH to c:\test my pa*th
Set Variable ILLEGAL_PATTERN to [?*"\|]
Set Variable RESULT to

Match string "$MYPATH$" to regular expression "$ILLEGAL_PATTERN$", return result in variable RESULT
if Variable RESULT Equals TRUE
MessageBox: Debug, Path contains not allowed characters!
end



Code: Select all

~InstallAware Clipboard Data~
~End~
~{970D8624-46C3-4579-9292-228853ABC057}~
~MessageBox~
~{D5FA8B62-F4E2-4476-8FC6-99EE3647EA51}~
~Debug~
~Path contains not allowed characters!~
~0~
~1~
~~
~If~
~{740837F9-D8BA-4690-ADA4-2695441DB1E2}~
~RESULT~
~0~
~TRUE~
~FALSE~
~Match Regular Expression~
~{4203C2CA-B8BF-4BB9-88B6-8EFE45528245}~
~RESULT~
~$ILLEGAL_PATTERN$~
~$MYPATH$~
~Comment~
~{F61E11DD-D883-4399-A697-DFB6A08B306F}~
~~
~Set Variable~
~{F2C37E85-36A4-4452-8CBC-6537433FE355}~
~RESULT$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{F0BD3777-039C-4593-968E-1E93D5F8D226}~
~ILLEGAL_PATTERN$MYAH$MYAH$FALSE~
~[?*"\|]~
~Set Variable~
~{2C6F4A85-0C8D-4601-B58B-8A412E044B4A}~
~MYPATH$MYAH$MYAH$FALSE~
~c:\test my pa*th~


Hope this helps you.