Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

From .bat to Autoit.

$
0
0
Hi guys,
I'm BRAND NEW to AutoIt. I discovered it while looking for a solution to automate the running of a wireless network installation script. Somebody had already written it, and I all I had to do was copy it and compile it with a few basic changes. It worked out REAAALY well, and got me excited about the prospect of learning AUTOIT to expand my abilities for certain issues I've been having.

I've got a small amount of regular .bat scripting and Linux shell scripting, but I'm completely new to the AutoIT language (or any REAL programming languages, for that matter.)

I've done a bit of digging through the help files, but I'm having trouble finding any command definitions, etc.

What I'm looking for is sort of a cross-reference from standard windows commands to AUTOit.

For example, in command, I could say,
"IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)

Which would send it to a different header in the script, depending on what the result was for 64 bit or 32 bit architecture.

Eg:
:32bit and
Do a, b, c

:64bit
Do x, y, z


And have separate commands for operations to complete for the specific architecture, then at the end of each series of operations, have another "goto" command send them to a new header.

How would one redirect the 'script' to a certain header in the script based on such a variable?

Also, is there a basic glossary of commands?

Can I run installers from network paths? such as
(msiexec /i ("\\server\installers\program.exe" /quiet)
?

Example of one thing I'd like to convert from a .bat file, and make into a workable autoit script that I can run hidden without the possibility of somebody closing the script window mid-way through the update:

[CODE]"IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)

:64BIT
ECHO 64BIT...
IF EXIST "C:\Program Files (x86)\old version of program (MsiExec.exe /X{oldversionuninstaller} /quiet)
If Not Exist "C:\Program Files (x86)\old version of program\" ("\\server\installers\x86installer.exe" /quiet)
GOTO Start64

:32BIT

:32bit
REM check for old version of program, and remove if it already exists.
If exist c:\programfiles\old version of program (MsiExec.exe /X{oldversionuninstaller} /quiet)
REM then to install new version
("\\server\installers\x86installer.exe" /quiet)
If Not Exist If exist c:\programfiles\old version of program ("\\server\installers\x86installer.exe" /quiet)
GOTO Start32

:Start32
START /wait "Title" "c:\programfiles\newversion\run.exe"
GOTO End

:Start64
rem start program and wait for it to exit
START /wait "Title" "c:\programfiles\newversion\run.exe"
GOTO: End

:End
endlocal
shutdown -f -r -t 03 -c "Shutdown and Restart after exiting app"


This is just an example for a generalized script that I have for my environment, where I need to run an updated installer that would remove any older versions, then launch the new program upon completion of install, then shutdown and reboot the machine after the end user closes out that particular program. I manage several hundred machines, and updates are usually pretty smooth, but there's always that one idiot who closes the command window while the script is running, and never gets the update installed. Going to a completely invisible script, or even locking user input using the BlockInput command is my primary reason for wanting to go ahead and learn a 'real' language.

If you guys who know batch commands could give me some pointers of what these sorts of commands would equate to in AutoIT, that would be really helpful. I was wishing that I could directly copy basic windows commands over and have it compile and execute it, but I knew before I tried it, it was probably a pipe dream. :/

Thanks so much in advance! Sorry to be such a n00b.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>