Sign in to follow this  
Followers 0
lolcatz

64 BIT 32 BIT AND OS if statements

17 posts in this topic

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 __________

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If @OSVersion = "WIN_7" and @OSArch = "X86" Then ; Windows 7 32 bit

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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.

If @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?

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

K I will look into that u guys are AMAZING! I cant thank you enough best,nice,helpful community ever!

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 by lolcatz

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by lolcatz

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 Gude
How 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

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

That worked Perfectly Thanks :idiot:

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 subfolders

http://www.mediafire.com/?1r0r9mpbbm9290t

when im done with the whole Auto format hard drive and auto install os and applications i will release it here first!

Edited by lolcatz

Share this post


Link to post
Share on other sites

Does that package (above) include MSE? I'm sure that is against Microsoft's terms and conditions.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0