We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ipollock
Posts: 137
Joined: Wed Aug 31, 2016 10:46 am

Custom Action - determine if a text box contains specific string (vbs)

I'm creating a model that will allow me to introduce restrictions of what may be place into a text box that populates a variable.

The current model uses a text box and then a custom action should look to see what is entered. If the entry contains an
underscore then a message will pop up, the process stopped until the user acknowledges the message and goes back to
change what they put in the text box.

it's all looking good but i've goosed up on the vbs part of this. I am able to put in a specific string and the process
works as expected - such as look for the string "testing" and the process prompts etc... as above. It's when i try to
use a more dynamic option such as look for "*_*" that it falls over and becomes valid each time. Is there a better
way to make this happen. I'm including my code and my model Aip.

Thanks in advance.

Ian

My vbs code:

svr_name = Session.Property("SVR_NAME")
' SVR_NAME is the public property of the "EditBox" control where the user enter the server name
' Session.Property("SVR_NAME") is the function used to get the value of the "SVR_NAME" property
' these are the minimum requirements for the server name to be valid

if InStr(svr_name "*_*")
then Session.Property("VALID_SVR_NAME") = "invalid"
'message box custom action via published event on dialogue box 'Next' button

else
' the server name is not invalid
Session.Property("VALID_SVR_NAME") = "valid"

end if
Attachments
My 19th Application.aip
(14.17 KiB) Downloaded 388 times
ipollock
Posts: 137
Joined: Wed Aug 31, 2016 10:46 am

Re: Custom Action - determine if a text box contains specific string (vbs)

OK, after much reading and this was mainly VBS, i had a flaw in the code.

It ended up you don't need the wild card in there to identify the underscore between other characters.
Here is the final model vbs logic for the Custom Action:

svr_name = Session.Property("SVR_NAME")
if inStr(svr_name, "_") then
Session.Property("VALID_SVR_NAME") = "invalid"
else
Session.Property("VALID_SVR_NAME") = "valid"
end if
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Custom Action - determine if a text box contains specific string (vbs)

Hi Ian,

I'm glad you solved the problem.

Just let us know anytime you need help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”