aleph01 Posted June 15, 2013 Share Posted June 15, 2013 (edited) Greetings: I am asking a best practices question. I am scripting to check on a variety of vendor (Envisionware) product versions. The script will query XP, possibly XP x-64, Win7 both 32 and 64 bit systems. My question is this: Since I know that some systems have both Program Files (x86)Envisionware and Program FilesEnvisionware folders, do I need to allow for a "dummy" variable ($x) in an Else statement. Is there a more elegant way? See my code below. By the way, forgive me if I forgot the code tags and make ugly code display, and thanks for your help. Ya'll (yes, I'm from GA and AL mostly) are very amusing, dealing with dogs who think they can post trash on your site without consequences. I really like your explanations of why someone gets banned, etc. It's not like I haven't been inadvertently rude, but it's nice to see the "entitled generation" get their dues. <autoit> dim $x = 0 If FileExists ("C:Program Files" & "Envisionware" ...) Then $x86 = FileGetVersion ("C:Program Files" & "Envisionware" ...) ElseIf FileExists ("C:Program Files (x86)" & "Envisionware" ...) Then $x64 = FileGetVersion ("C:Program Files (x86)" & "Envisionware" ...) Else $x = 0 EndIf </autoit> |Ah, it looks like I need a reminder on posting code... Edited June 15, 2013 by aleph01 Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
TheSaint Posted June 15, 2013 Share Posted June 15, 2013 Personally, I check the usual place/s, then provide a File Select dialog if not found. That seems to be the simplest solution, as in reality, it could probably be installed anywhere? I also back that up with file exists checks for later program executions ... and file browse prompts if necessary. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
DW1 Posted June 15, 2013 Share Posted June 15, 2013 (edited) I think I understand your question. If so, this will make sense, otherwise just let me know I'm off base An If, ElseIf doesn't NEED an Else at the end of it. You can just EndIf without using an Else at all (just using multiple ElseIf if that is what you are after). So there would be no point or need for $x in your example code. Edited June 15, 2013 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
aleph01 Posted June 15, 2013 Author Share Posted June 15, 2013 TheSaint: WooHoo! I think FileSelectFolder will help me. Didn't bring enough home with me to work on this before Monday (I'm hourly, no OT or on call officially, but I work on .au3 scripts for work at home when the need arises.) Don't understand your reference to file browse prompts, though. Can you bring your lingo on that down to noob level? Thanks. Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
aleph01 Posted June 15, 2013 Author Share Posted June 15, 2013 danwilli, Yes, that answers my question exactly. Thanks to TheSaint for also helpful input. Like your Zappa. He's not forgotten - he pioneered freedom of speech in art. Thanks again, all. I'll be back. _aleph_ DW1 1 Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
TheSaint Posted June 15, 2013 Share Posted June 15, 2013 TheSaint: Don't understand your reference to file browse prompts, though. Can you bring your lingo on that down to noob level? Thanks. That only applies, if the program gets re-installed to another location or the exe name changes (upgrade, etc) .... anything to do with the filepath. Basically, if the file exists check comes up negative, then you present the user with a prompt, which is pretty much a similar version of the File Select dialog. That's just for insurance though, and definitely not required, unless you want to be thorough. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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