wowmarkb Posted February 15, 2008 Share Posted February 15, 2008 Hi all. I would like a script that: 1) Checks the computer's Operating System (it only needs to verify these: Win98/ME/2000/XP/Vista). I know that "@OSVersion" is the macro to use but, how do use it in a script? A line that says "Get @OSVersion" ? 2) Then, based on that value (example: "win_xp"), the script will take that variable and then run the proper autoit script that dispays the GUI for that OS. I will have 3 or 4 GUI scripts. One each for: Win98/ME, Win2000, WinXP/Vista (maybe XP & Vista have thier own scripts). The difference between the scripts will be what buttons are displayed since not all OS can run each of the commands I have scripted. Thanks, Mark Link to comment Share on other sites More sharing options...
wowmarkb Posted February 15, 2008 Author Share Posted February 15, 2008 OK, I just found this. Do you think this wll this work in my case? (Of course I would change the line like "RunWait['Update95_1.exe']" to run my proper script.) Select Case @OSVersion = 'WIN_95' RunWait['Update95_1.exe'] RunWait['Update95_2.exe'] Case @OSVersion = 'WIN_98' RunWait['Update98_1.exe'] RunWait['Update98_2.exe'] Case Else MsgBox[0, 'ERROR', 'Unsupported operating system; this utility only works on Windows 95 and 98.'] EndSelect Thanks, Mark Link to comment Share on other sites More sharing options...
Monamo Posted February 15, 2008 Share Posted February 15, 2008 Hi all. I would like a script that: 1) Checks the computer's Operating System (it only needs to verify these: Win98/ME/2000/XP/Vista). I know that "@OSVersion" is the macro to use but, how do use it in a script? A line that says "Get @OSVersion" ? 2) Then, based on that value (example: "win_xp"), the script will take that variable and then run the proper autoit script that dispays the GUI for that OS. I will have 3 or 4 GUI scripts. One each for: Win98/ME, Win2000, WinXP/Vista (maybe XP & Vista have thier own scripts). The difference between the scripts will be what buttons are displayed since not all OS can run each of the commands I have scripted. Thanks, Mark Yep, you're on the right track with @OSVersion (the help file has all of the actual return values you'd want to check for). There are a couple different ways to handle it that come to mind offhand. You could just do a series of "If" statements: If @OSVersion = "WIN_VISTA" Then _VistaGUI() If @OSVersion = "WIN_XP" Then _XPGUI() ... Or a Select...Case: CODE Select Case @OSVersion = "WIN_VISTA" ; do stuff here Case @OSVersion = "WIN_XP" ; do stuff here Case @OSVersion = "WIN_2000" ; do stuff here Case @OSVersion = "WIN_ME" ; do stuff here Case @OSVersion = "WIN_98" ; do stuff here Case Else MsgBox(48, "Unsupported OS", "This application is not designed to run on this operating system.") Exit EndSelect - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
BrettF Posted February 15, 2008 Share Posted February 15, 2008 (edited) OK, I just found this. Do you think this wll this work in my case? (Of course I would change the line like "RunWait['Update95_1.exe']" to run my proper script.) Select Case @OSVersion = 'WIN_95' RunWait['Update95_1.exe'] RunWait['Update95_2.exe'] Case @OSVersion = 'WIN_98' RunWait['Update98_1.exe'] RunWait['Update98_2.exe'] Case Else MsgBox[0, 'ERROR', 'Unsupported operating system; this utility only works on Windows 95 and 98.'] EndSelect Thanks, MarkWhat have your 30 odd posts been? The helpfile has all the answers! @OS_VERSION will return... "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95" Use that in combintation with a switch statement which is in the helpfile(there's the magic word again) and you're all good! Also, where the hell are u getting ( = [ and ) = ] from? Only one type of bracket with functions. Those that are curved. (). EDIT: Clarafied... Edited February 15, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
wowmarkb Posted February 15, 2008 Author Share Posted February 15, 2008 Thanks to you both for your answers.Aaarrgghh. The last thing a "newbie" wants to hear is "Everything you need is in the Help file". I looked in the Help section and saw "@OSVersion" and "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95". OK, I got that much. But, what do you do with the answer? There are NO examples that tell me how to use that answer and run a script based on that value. If all I wanted was to display the computer's OS, you're right- the anwer is there.Sometimes the answewr may be right there but a "newbie" doesn't know what to do with the data. That is what is so frustrating for a "newbie"- we don't know what we're doing or sometimes even how to word the question to get the answer we're looking for.Yes, I've had many posts and I am learning. Most posts were for a routine that people gave me scripts for but, that didn't do what I wanted it to do. But hey, the community was there to help me and I got the answer- you guys/gals Rock!Oh, the script I found and posted above is at: http://www.postfinder.com/post/24307838.html How did you guys/gals learn this stuff? Thanks, Mark Link to comment Share on other sites More sharing options...
SpookMeister Posted February 15, 2008 Share Posted February 15, 2008 @wowmarkb: Did you see Monamo's post, right above bert's? He shows you exactly what you need to do (I like the Select..Case example better personally) -Spook [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
wowmarkb Posted February 15, 2008 Author Share Posted February 15, 2008 @wowmarkb: Did you see Monamo's post, right above bert's?He shows you exactly what you need to do (I like the Select..Case example better personally)-SpookYes, that is exactly what I needed to know. When I get home, I'll try thatThanks,Mark Link to comment Share on other sites More sharing options...
SpookMeister Posted February 15, 2008 Share Posted February 15, 2008 For the record, Bert also gave you the same basic info, he just directed you to the helpfile to look up what you needed instead of handing you an example. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
wowmarkb Posted February 15, 2008 Author Share Posted February 15, 2008 You are right. I needed the example though. Thanks, Mark 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