lolcatz Posted December 16, 2012 Share Posted December 16, 2012 Im trying to find out how to detect the operating system and bit version then run a program based of that For example If Windows 7/8 32 bit then run _______ If windows 7/8 64 but then run _________ If windows vista/xp 32 bit run __________ If windows vista/xp 64 bit run __________ Link to comment Share on other sites More sharing options...
water Posted December 16, 2012 Share Posted December 16, 2012 Welcome to AutoIt and the forum! Please have a look at the @OSArch and @OSVersion macros. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lolcatz Posted December 16, 2012 Author Share Posted December 16, 2012 Thank You! You lead me in the right direction. I will research it my self but further help is still be appreciated. If someone can write a sample script, that would be awesome. Link to comment Share on other sites More sharing options...
water Posted December 16, 2012 Share Posted December 16, 2012 (edited) If @OSVersion = "WIN_7" and @OSArch = "X86" Then ; Windows 7 32 bit Edited December 16, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
guinness Posted December 16, 2012 Share Posted December 16, 2012 Thank You! You lead me in the right direction. I will research it my self but further help is still be appreciated. If someone can write a sample script, that would be awesome.Give it a try first, then if you get stuck show what you've done and we will help. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
lolcatz Posted December 17, 2012 Author Share Posted December 17, 2012 I been trying to make an auto installer for windows Microsoft enstinals and i need it to read what bit version then install the file based on that. Since i can not include another exetuable i need it check my flash drive and find the file there. But the flash drives can change letters on different computers so i need to scan all of them. expandcollapse popupIf @OSVersion = "WIN_XP" Then Run("E:\SLIENT\mse xp_slient.exe") Run("F:\SLIENT\mse xp_slient.exe") Run("G:\SLIENT\mse xp_slient.exe") Run("H:\SLIENT\mse xp_slient.exe") Run("I:\SLIENT\mse xp_slient.exe") Run("J:\SLIENT\mse xp_slient.exe") Run("K:\SLIENT\mse xp_slient.exe") Run("L:\SLIENT\mse xp_slient.exe") Run("M:\SLIENT\mse xp_slient.exe") Run("N:\SLIENT\mse xp_slient.exe") Run("O:\SLIENT\mse xp_slient.exe") Run("P:\SLIENT\mse xp_slient.exe") Run("Q:\SLIENT\mse xp_slient.exe") Run("R:\SLIENT\mse xp_slient.exe") Run("S:\SLIENT\mse xp_slient.exe") Run("T:\SLIENT\mse xp_slient.exe") Run("U:\SLIENT\mse xp_slient.exe") Run("V:\SLIENT\mse xp_slient.exe") Run("W:\SLIENT\mse xp_slient.exe") Run("X:\SLIENT\mse xp_slient.exe") Run("Y:\SLIENT\mse xp_slient.exe") Run("Z:\SLIENT\mse xp_slient.exe") ElseIf @OSArch ="X86" Then Run("E:\SLIENT\mse 32 bit_silent.exe") Run("F:\SLIENT\mse 32 bit_silent.exe") Run("G:\SLIENT\mse 32 bit_silent.exe") Run("H:\SLIENT\mse 32 bit_silent.exe") Run("I:\SLIENT\mse 32 bit_silent.exe") Run("J:\SLIENT\mse 32 bit_silent.exe") Run("K:\SLIENT\mse 32 bit_silent.exe") Run("L:\SLIENT\mse 32 bit_silent.exe") Run("M:\SLIENT\mse 32 bit_silent.exe") Run("N:\SLIENT\mse 32 bit_silent.exe") Run("O:\SLIENT\mse 32 bit_silent.exe") Run("P:\SLIENT\mse 32 bit_silent.exe") Run("Q:\SLIENT\mse 32 bit_silent.exe") Run("R:\SLIENT\mse 32 bit_silent.exe") Run("S:\SLIENT\mse 32 bit_silent.exe") Run("T:\SLIENT\mse 32 bit_silent.exe") Run("U:\SLIENT\mse 32 bit_silent.exe") Run("V:\SLIENT\mse 32 bit_silent.exe") Run("W:\SLIENT\mse 32 bit_silent.exe") Run("X:\SLIENT\mse 32 bit_silent.exe") Run("Y:\SLIENT\mse 32 bit_silent.exe") Run("Z:\SLIENT\mse 32 bit_silent.exe") ElseIf @OSArch ="X64" Then Run("E:\SLIENT\mse 64 bit_silent.exe") Run("F:\SLIENT\mse 64 bit_silent.exe") Run("G:\SLIENT\mse 64 bit_silent.exe") Run("H:\SLIENT\mse 64 bit_silent.exe") Run("I:\SLIENT\mse 64 bit_silent.exe") Run("J:\SLIENT\mse 64 bit_silent.exe") Run("K:\SLIENT\mse 64 bit_silent.exe") Run("L:\SLIENT\mse 64 bit_silent.exe") Run("M:\SLIENT\mse 64 bit_silent.exe") Run("N:\SLIENT\mse 64 bit_silent.exe") Run("O:\SLIENT\mse 64 bit_silent.exe") Run("P:\SLIENT\mse 64 bit_silent.exe") Run("Q:\SLIENT\mse 64 bit_silent.exe") Run("R:\SLIENT\mse 64 bit_silent.exe") Run("S:\SLIENT\mse 64 bit_silent.exe") Run("T:\SLIENT\mse 64 bit_silent.exe") Run("U:\SLIENT\mse 64 bit_silent.exe") Run("V:\SLIENT\mse 64 bit_silent.exe") Run("W:\SLIENT\mse 64 bit_silent.exe") Run("X:\SLIENT\mse 64 bit_silent.exe") Run("Y:\SLIENT\mse 64 bit_silent.exe") Run("Z:\SLIENT\mse 64 bit_silent.exe") EndIf when I run it I get a ugi telling me that there is no drive there and should continue or cancel after i click continue 5 times then It runs the program Is there any way to go around this problem? Link to comment Share on other sites More sharing options...
water Posted December 17, 2012 Share Posted December 17, 2012 Create a function which you pass the filename. The function loops through all the available drives (DriveGetDrive) and uses FileExist to check if the file exists. If it does, run it. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lolcatz Posted December 17, 2012 Author Share Posted December 17, 2012 K I will look into that u guys are AMAZING! I cant thank you enough best,nice,helpful community ever! Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2012 Share Posted December 17, 2012 You may want to look at this: The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
lolcatz Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) Create a function which you pass the filename. The function loops through all the available drives (DriveGetDrive) and uses FileExist to check if the file exists. If it does, run it. Im having trouble with the code this is the best i got Local $aArray = DriveGetDrive("REMOVABLE") $name = "SLIENTmse 32 bit_silent.exe" For $i = 1 To $aArray[0] If FileExists(StringUpper($aArray[$i]) &$name) Then Run(StringUpper($aArray[$i]) &$name) EndIf Next You may want to look at this: I been trying to make something like this. I want to auto detect which OS it runs on then auto format its hard drive. and then auto re install the operation system. Im done with making silent applications like coddecs flashplayer and ect, But now i have to program to auto detect which programs to install. I want it to be completely automatically. Edited December 17, 2012 by lolcatz Link to comment Share on other sites More sharing options...
Bert Posted December 18, 2012 Share Posted December 18, 2012 Im having trouble with the code this is the best i got Local $aArray = DriveGetDrive("REMOVABLE") $name = "SLIENTmse 32 bit_silent.exe" For $i = 1 To $aArray[0] If FileExists(StringUpper($aArray[$i]) &$name) Then Run(StringUpper($aArray[$i]) &$name) EndIf Next I been trying to make something like this. I want to auto detect which OS it runs on then auto format its hard drive. and then auto re install the operation system. Im done with making silent applications like coddecs flashplayer and ect, But now i have to program to auto detect which programs to install. I want it to be completely automatically. your welcome to harvest the code to help you out. Are you planning to use a boot CD to do this? I'm asking for you say you want to re-install the OS. Also - Is this going to be a go to tool for all PCs you service? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
lolcatz Posted December 18, 2012 Author Share Posted December 18, 2012 (edited) its not going to be on from a boot cd its going to be off a USB drive. I already know how to make it so it can auto format and auto re install the OS, Then as soon it starts up it self install unattended applications. Yes im going to use it on the computer i service. All that i want to do is plug in my usb come back 2 hrs latter and the computer should be good as new. Im also gana release it to the public when im done with it. I got it to work now but i still get error msgs that no dirve exist $var = DriveGetDrive( "REMOVABLE" ) If NOT @error Then For $i = 1 to $var[0] $drive = $var[$i] If FileExists (StringUpper ($drive)&"SLIENTmse 32 bit_silent.exe")Then Run(StringUpper ($drive)&"SLIENTmse 32 bit_silent.exe") EndIf Next EndIf; Edited December 18, 2012 by lolcatz Link to comment Share on other sites More sharing options...
BrewManNH Posted December 18, 2012 Share Posted December 18, 2012 If the script is on the same drive as the software to be installed, use relative path names instead of using the drive letter. For example, your software is in "E:Software installssoftware to install". Instead of trying to find out which drive letter it is running from you can use "Software installssoftware to install" as long as the script is running from the same drive and you set the working directory to that drive as well. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
lolcatz Posted December 18, 2012 Author Share Posted December 18, 2012 If the script is on the same drive as the software to be installed, use relative path names instead of using the drive letter. For example, your software is in "E:Software installssoftware to install". Instead of trying to find out which drive letter it is running from you can use "Software installssoftware to install" as long as the script is running from the same drive and you set the working directory to that drive as well. I tried this it dint work for me If @OSArch ="X86" Then Run("SLIENTnotepad.txt") ElseIf @OSArch ="X64" Then Run("SLIENTnotepad.txt") EndIf im not auto it proficient but im gana recommend it to everyone in all my programming class its so easy to learn and can do some amazing stuff Link to comment Share on other sites More sharing options...
BrewManNH Posted December 18, 2012 Share Posted December 18, 2012 That doesn't work because a text file isn't runnable, use ShellExecute instead of Run and let us know how it goes. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
lolcatz Posted December 19, 2012 Author Share Posted December 19, 2012 (edited) That worked Perfectly Thanks Here is the package that auto installs Microsoft security essentials. You cant run it from the desktop tho it has to be extracted directly into one of your drives with no subfoldershttp://www.mediafire.com/?1r0r9mpbbm9290twhen im done with the whole Auto format hard drive and auto install os and applications i will release it here first! Edited December 19, 2012 by lolcatz Link to comment Share on other sites More sharing options...
guinness Posted December 19, 2012 Share Posted December 19, 2012 Does that package (above) include MSE? I'm sure that is against Microsoft's terms and conditions. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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