I googled and found a great resource about using AutoIt with Microsoft Visual C# and received the error message mentioned at http://www.autoitscript.com/forum/index.php?showtopic=21357: Retrieving the COM class factory for component with CLSID {1A671297-FA74-4422-80FA-6C5D8CE4DE04} failed due to the following error: 80040154.
When you use Windows XP Professional x64, Microsoft Visual C# editions will compile with x64 support. The default is set to use “any CPU”. AutoIt however uses x86 and therefore I received the aforementioned error.
Although the target platform property is unavailable with Visual C# Express Edition, msdn offer a solution, http://msdn.microsoft.com/vstudio/express/support/issues.
I solved the issue, opened the .csproj file, located the first <PropertyGroup> section, and added <PlatformTarget>x86</PlatformTarget>.
I use a similar code as for the AutoIt installation of Visual C# Express 2005. When you load the code with notepad, replace all strings with “Visual C# 2005 Express Edition Setup” to “Visual Web Developer 2005 Express Edition Setup”.
;Installing Visual C# Express with AutoIt works simple
; —————————————————————————-
;
; AutoIt Version: 3.1.0
; Author: Adam Manuel
;
; Script Function:
; Install Visual C# 2005 Express Edition
;
; When you execute this script, you take the full responsibility
; I’m irresponsible for any damage caused.
; The script successfully ran on my machine, Windows XP x64 Professional
; —————————————————————————-
;Compare the Window Class with your installation
;Visual C# 2005 Express Edition Setup
;Class: ATL:4F228AE8
If not IsAdmin() Then
MsgBox(0, “”, “Admin rights required!”)
Exit
EndIf
WinWaitActive(”Visual C# 2005 Express Edition Setup”)
; Focus the button next
ControlFocus(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Click next
ControlClick(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Focus the checkbox Accept
ControlFocus(”Visual C# 2005 Express Edition Setup”, “”,”Button19″)
; Click and check Accept
ControlClick(”Visual C# 2005 Express Edition Setup”, “”,”Button19″)
; Focus “next”
ControlFocus(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Click next
ControlClick(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Focus “next”
ControlFocus(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Click “next”
ControlClick(”Visual C# 2005 Express Edition Setup”, “”,”Button21″)
; Focus “install”
ControlFocus(”Visual C# 2005 Express Edition Setup”, “”,”Button5″)
; click install
ControlClick(”Visual C# 2005 Express Edition Setup”, “”,”Button5″)
Download source and executable:
InstallCSharp.zip
Related links:
http://www.autoitscript.com/autoit3/
You can power off Windows XP, the English version, using three keys in succession.
- CTRL+ESC
- u
- u
AutoIt could press these keys.
Code:
Send(”{CTRLDOWN}”)
Send(”{ESC}”)
Send(”{CTRLUP}”)
Send(”u”)
Send(”u”)
Related links:
http://www.autoitscript.com/autoit3/
The following code demonstrates AutoIt’s simple and usefulness. Although I programmed for more than ten years, it should be understood by everyone. Line two and three should be used, when you receive an pop up error message on x64 systems like Windows XP x64 Professional.
Run(”control mmsys.cpl”)
;WinWaitActive(”DRIVERS32″)
;ControlFocus(”DRIVERS32″, “”,”Button1″)
;ControlClick(”DRIVERS32″, “”,”Button1″)
WinWaitActive(”Sounds and Audio Devices Properties”)
Send(”^{TAB}”)
Send(”^{TAB}”)
ControlFocus(”Sounds and Audio Devices Properties”, “”,”ComboBox1″)
Send(”{END}”)
ControlFocus(”Sounds and Audio Devices Properties”, “”,”Button22″)
ControlClick(”Sounds and Audio Devices Properties”, “”,”Button22″)
Explanation:
“control mmsys.cpl” is executed in the command line, check it yourself, see what you get.
; means this line will be ignored.
“WinWaitActive(..)” the usage of this function is explained by its name.
“Send” is used to send keys virtually to the pc.
“^TAB” means change to the next Tab Window.
“ControlFocus(..)” will select and focus ComboBox, Button, or Checkbox. You can get its name by using the Window Info Tool provided with AutoIt.
“ControlClick(..)” will click the selected Button
“{END}” the End key is pressed.
Download script and executable:
ChangeAudioDeviceX64.zip
ChangeAudioDeviceX.zip
Related links:
http://www.autoitscript.com/autoit3/
I dislike to accomplish the same task continuously especially on computer. For instance: When I play games or watch dvds, I often change the default audio device to use headphones – onboard uses stereo speakers, external 5.1 headset.
AutoIt is a great software and provides the ability to execute applications, press buttons on your keyboards virtually, and move your mouse. Although the code is entered in notepad, the syntax looks Visual Basic like and simple.
Related links: http://www.autoitscript.com/autoit3/