TForgay Posted May 2, 2012 Share Posted May 2, 2012 I have a simple example here and I am not sure how I would go about making this work. I want this script to launch either google or yahoo based on the $Site variable. I have hard coded "Google" in that site variable. I want to build the Variable name $GoogleURL when the $Site is equal to Google and $YahooURL when $Site is equal to "Yahoo".$URLString does rebuild the variable name, however when I try to concatenate that in a string, the string will display $GoogleURL instead of passing on http://www.google.comI have an actual application for this need, so don't be concerned that i have simplified this down to getting to either Google or Yahoo. I could do IF or Case statements however I will be dealing with 40+ sites in the practical application and anted to stay away from having to do so many IF or Case Statements......$GoogleURL = "http://www.google.com"$YahooURL = "http://www.yahoo.com"$Site = "Google"$URLString = ("$"&$Site & "URL")MsgBox(0,"Launch Site","Internet Explorer will open up to " & $Site & " at " & $URLString)ShellExecute ("iexplore.exe","-extoff " & $URLString) Link to comment Share on other sites More sharing options...
Realm Posted May 2, 2012 Share Posted May 2, 2012 Hello TForgay, Use Eval() in this type of situation. $URLString = Eval( $Site & 'URL' ) Good Luck & Happy Coding! Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
TForgay Posted May 2, 2012 Author Share Posted May 2, 2012 Mass Spammer, you are AWESOME to have replied so quickly. This is EXACTLY what I needed and works just great. I am new to this and still learning. Thanks again... Link to comment Share on other sites More sharing options...
Realm Posted May 2, 2012 Share Posted May 2, 2012 (edited) Mass SpammerMy Public ID is 'Realm'. Mass Spammer is only a generic title for members with 500+ posts.When you post a reproducer script, explain what it is your attempting to achieve, what errors/wrong results you are getting, and finally what you expect your script to do, all in which you had done, help will generally come fast. So the thanks goes to you for posting enough information which is a rarity with most new members.btw, Your Welcome!Good Luck with your script; Happy Coding!RealmEdit: Actually, I think the 'Mass Spammer' Title comes much earlier. I'd like to say 100 posts, but I am not for sure. Edited May 2, 2012 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now