Jump to content

Adding a GUI to a batchfile


choward
 Share

Recommended Posts

Hi, I have a batch file that installs some programs and changes some registry keys and then asks if everything installed correctly. I want to make a nice GUI for this, I've been looking at .hta files but these all involve pressing a button in a nice GUI that then opens the batch file like normal, basically I want it to embed the batch file in the GUI.

Link to comment
Share on other sites

  • Developers

It is all possible, Not sure what your batch files does, but you probably don;t even need the batch file but can use AutoIt3 syntax for everything.
You are able to shell CUI programs and capture their STDOUT / STDERRR output.

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

choward,

It most certainly would - see here how to do it.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@ECHO off
COLOR 1F
:START
@ECHO Install BRM OEM ...
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v Logo /t REG_SZ /d "C:\Windows\BRM Computers\oem.bmp" /reg:64 /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v Manufacturer /t REG_SZ /d "BRM Computers" /reg:64 /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportHours /t REG_SZ /d "Mon-Fri 9am-5pm - Sat 9am-4pm" /reg:64 /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportPhone /t REG_SZ /d "08712 244129" /reg:64 /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportURL /t REG_SZ /d "hhtp://www.brmcomputers.co.uk" /reg:64 /f
MD "C:\Windows\BRM Computers\"
%EXTD% /unzip oem.zip "C:\Windows\BRM Computers\"
@ECHO Installing Chocolatey ...
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
@ECHO Installing Google Chrome ...
CHOCO install googlechrome -y
@ECHO Installing Firefox ...
CHOCO install firefox -y
@ECHO Installing VLC Media Player ...
CHOCO install vlc -y
@ECHO Installing 7zip ...
CHOCO install 7zip -y
@ECHO Installing Flash Player ...
CHOCO install flashplayerplugin -y
@ECHO Installing Java ...
CHOCO install javaruntime -y
@ECHO Installing Adobe Reader ...
CHOCO install adobereader -y
@ECHO Installing Kaspersky Internet Security ...
CHOCO install kisbrm -version 16.0.0.614 -y
@ECHO Installing Apache OpenOffice ...
CHOCO install openoffice -y
@ECHO Installing TeamViewer ...
CHOCO install teamviewer -y
@ECHO Settings taskbar icons ...
DEL /F /S /Q /A "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*"
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband /F
TASKKILL /f /im explorer.exe
START explorer.exe
TIMEOUT 5 /NOBREAK
DEL /F /S /Q /A "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*"
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband /F
TASKKILL /f /im explorer.exe
START explorer.exe
TIMEOUT 5 /NOBREAK
SYSPIN "C:\Program Files\Mozilla Firefox\firefox.exe" c:5386
SYSPIN "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" c:5386
SYSPIN "C:\Windows\explorer.exe" c:5386
:QUESTION
SET /p ANSWER=Did everything install correctly? (Y/N):
IF /i %ANSWER% == Y GOTO YES
IF /i %ANSWER% == y GOTO YES
IF /i %ANSWER% == Yes GOTO YES
IF /i %ANSWER% == yes GOTO YES
IF /i %ANSWER% == N GOTO NO
IF /i %ANSWER% == n GOTO NO
IF /i %ANSWER% == No GOTO NO
IF /i %ANSWER% == no GOTO NO
GOTO QUESTION
:YES
EXIT
:NO
GOTO START
GOTO QUESTION

 

Link to comment
Share on other sites

  • Developers

Just open SciTE and open/create a file somename.au3.
Press F1 and start looking for the following commands (sequence of your batchfile):

  • DirCreate
  • RegWrite()
  • DirCreate()
  • ShellExecuteWait() or RunWait() to run the unzip command you use and possibly the powershell command
  • same for subsequent installs
  • etc

Just look at the GUI section of the helpfile to find examples of GuiCtreate and all its possible controls.
Post questions when you have tried something and hitting a brick wall. :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I am not in the "write a script" business, but have no issue helping people that are trying/learning themselves. ;)
You have been given some pointers how to start and I am wondering whether you have started with those first steps yet.

Jos
 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
41 minutes ago, choward said:

I'm not sure how to add in files like the zips.

FileInstall() ?

Do you really want to add the installers to the Script as you now also shell them from somewhere? 

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

DirCreate("C:\Windows\BRM Computers\")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation", "Logo", "REG_SZ", "C:\Windows\BRM Computers\oem.bmp")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation", "Manufacturer", "REG_SZ", "BRM Computers")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation", "SupportHours", "REG_SZ", "Mon-Fri 9am-5pm - Sat 9am-4pm")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation", "SupportPhone", "REG_SZ", "08712 244129")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation", "SupportURL", "REG_SZ", "http://www.brmcomputers.co.uk")
Example()
Func Example()
    Local $iReturn = RunWait(@ComSpec & " /c " & "@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin")
    MsgBox($MB_SYSTEMMODAL, "", "The return code from CMD was: " & $iReturn)
EndFunc

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...