Jump to content

Auto Installing Applications


Recommended Posts

I was wondering what type of function you can use to agree to installing an app. Like "Next" "I Agree" "Next" "Next" "Install". I thought I saw a function that allowed these actions but I forget and have totally gone nuts trying to find it again :lmao:

What I am doing with it is to install some apps that my job uses and then notes what it has done like if we ran a clean up tool that it would be able to pick up what was done in a GUI. I got the development of the GUI but just need to put the functions in to test it out. I have tried with the MouseClick function but the computers are never the same rez and width. So it would be kind of hard to make a Exe for every rez and width lol. I will post what I used to use that I was hoping would help but doesnt work as intended :whistle:

MsgBox(0, "Post Ops", "-")

$TempPath = EnvGet("TEMP")
$Drive = "H:\Post Ops"

;Starting by creating a few directories
DirCreate($TempPath & "\Post Ops")
DirCopy($Drive, $TempPath & "\Post Ops", 1)


TrayTip("Post Ops", "Installing Registry Mechanic", 10)
Run($TempPath & "\Post Ops\MISC\REGISTRY MECHANIC V6.0.EXE")
Sleep(3000)
;We will now wait for the Executable to become active and then start the install.
If WinExists("Setup -") Then
    MouseClick("Left", 625, 540, 1)
    Sleep(1000)
    MouseClick("Left", 310, 477, 1)
    sleep(1000)
    MouseClick("Left", 625, 540, 1)
    Sleep(1000)
    MouseClick("Left", 625, 540, 1)
    Sleep(1000)
    MouseClick("Left", 625, 540, 1)
    Sleep(7000)
    MouseClick("Left", 625, 540, 1)
Else
    MsgBox(0, "Error", "Setup is not active yet! Going to time out for 10 seconds.")
    Sleep(10000)
EndIf
;We have just installed the program. We will now wait 2 mins to let it scan.
Sleep(60000)
;Now that the scan is finished lets complete the rest of the steps and then close out of it.
If WinExists("Registry Mechanic") Then
    MouseClick("Left", 767, 656, 1)
    Sleep(15000)
    MouseClick("Left", 695, 526, 1)
    Sleep(5000)
    MouseClick("Left", 869, 132, 1)
Else
    MsgBox(0,"Error", "We could not complete because the Window is not active yet! Sleeping for 10 seconds.")
    sleep(10000)
EndIf
;We have now successfully finished installing Registry Mechanic and running it and closing it.
TrayTip("Post Ops", "Uninstalling Registry Mechanic", 10)
Run("C:\Program Files\Registry Mechanic\unins000.exe")
Sleep(10000)
;We now will uninstall Registry Mechanic.
If WinExists("Uninstall") Then
    MouseClick("Left", 473, 435, 1)
    Sleep(1000)
    MouseClick("Left", 361, 385, 1)
    Sleep(1000)
    MouseClick("Left", 511, 436, 1)
    Sleep(8000)
    MouseClick("Left", 511, 436, 1)
Else
    MsgBox(0, "Post Ops", "Uninstaller not active! Sleeping for 10 Seconds.")
    Sleep(10000)
EndIf

TrayTip("Post Ops", "Installing CCleaner", 10)
Run($TempPath & "\Post Ops\MISC\CCLEANER V1.39.502.EXE")
Sleep(5000)

If WinExists("Installer Language") Then
    MouseClick("Left", 518, 426, 1)
    Sleep(1500)
    MouseClick("Left", 620, 539, 1)
    Sleep(1500)
    MouseClick("Left", 620, 539, 1)
    Sleep(1500)
    MouseClick("Left", 620, 539, 1)
    Sleep(1500)
    MouseClick("Left", 620, 539, 1)
    Sleep(8000)
    MouseClick("Left", 620, 539, 1)
Else
    MsgBox(0, "Error", "Installer Language is not active! Sleeping for 10 Seconds.")
    Sleep(10000)
EndIf

TrayTip("Post Ops", "Running CCleaner", 10)
Run("C:\Program Files\CCleaner\ccleaner.exe")
Sleep(5000)

If WinExists("CCleaner") Then
    MouseClick("Left", 736, 542, 1)
    Sleep(15000)
    MouseClick("Left", 659, 351, 1)
    Sleep(2000)
    MouseClick("Left", 245, 356, 1)
    Sleep(1500)
    MouseClick("Left", 573, 542, 1)
    Sleep(25000)
    MouseClick("Left", 514, 436, 1)
    Sleep(2000)
    MouseClick("Left", 536, 482, 1)
    Sleep(2000)
    MouseClick("Left", 473, 425, 1)
    Sleep(10000)
    MouseClick("Left", 686, 484, 1)
    Sleep(1500)
    MouseClick("Left", 805, 189, 1)
Else
    MsgBox(0, "Post Ops", "CCleaner is not active! Sleeping for 10 Seconds.")
    Sleep(10000)
EndIf

TrayTip("Post Ops", "Uninstalling CCleaner", 10)
Run("C:\Program Files\CCleaner\uninst.exe")
Sleep(5000)

If WinExists("CCleaner v1.39 Uninstall") Then
    MouseClick("Left", 622, 540, 1)
    Sleep(1500)
    MouseClick("Left", 622, 540, 1)
    Sleep(3000)
    MouseClick("Left", 622, 540, 1)
Else
    MsgBox(0, "Error", "Uninstaller is not active! Sleeping for 10 Seconds.")
    Sleep(10000)
EndIf
Link to comment
Share on other sites

I was wondering what type of function you can use to agree to installing an app. Like "Next" "I Agree" "Next" "Next" "Install". I thought I saw a function that allowed these actions but I forget and have totally gone nuts trying to find it again :lmao:

ControlClick() will click on the control so resolution is not a concern for it and neither is an active window a requirement as compared to using MouseClick() or Send(). Look at using Control*() function for your installations for the most reliable results.

Example:

WinWait('Title', 'Text')
ControlClick('Title', 'Text', 'Next')

:whistle:

Link to comment
Share on other sites

What would you think if you run the program afterwords and its lets say running its clean up and it hasnt finished yet but when its finished it would hit the next button. Is there anyway to predict it or would I have to use a sleep for so many minuates?

Link to comment
Share on other sites

What would you think if you run the program afterwords and its lets say running its clean up and it hasnt finished yet but when its finished it would hit the next button. Is there anyway to predict it or would I have to use a sleep for so many minutes?

You can cleanup after the process is complete.

; Start your installer and store the ProcessID.
$pid = Run('your file')

; Do your automation.

; Wait for installer process to finish.
ProcessWaitClose($pid)

; Do your cleanup.
FileDelete(@DesktopDir & '\shortcut.lnk')

Perhaps at worst, add a small sleep before your cleanup or use a loop until a certain marker (file) exists.

Link to comment
Share on other sites

I mean like if a program is running but you have to put some user interaction to it for it to close after its done scanning or what not. Kind of like this

WinActive('Setup -")
ControlClick('Setup', 'Blah', 'Next')
;Window finishes installing and closes to make a new process

WinActive("Runing Program")
Sleep(60000)
ControlClick("Running Program", "blah", "Continue")

Would something like that work or if it is possible the script will wait until it can figure out that its done and the continue button is now clickable or there?

Link to comment
Share on other sites

Sure, you can wait for the new process if you would like to like below.

If ProcessWait('SpawnedProcess.exe', 60) Then
    ; Get the ProcessID if you like
    $pid = ProcessExists('SpawnedProcess.exe')
    ; Do something with SpawnedProcess windows etc
    ; ...
    ProcessWaitClose($pid)
EndIfoÝ÷ Úâ*.ÁêÞlº·¢~+p¢é]jºâ½ë(vè·§¶Ú0jËmg­é墴e±'i¹^jw@vX+nWºÚ"µÍÈ[ØÙÜÈ[ÚYYX[XJ    ÌÎNÐYXÌÎNÊBÈØZ]HÛÝHÙÙXÛÛÈYÜH[Ý[ÈÛÛY

B^][ÈYX
BRYØÙÜÑ^ÝÊ    ÌÎNÔÜ]ÛYØÙÜË^IÌÎNÊH[BNÈÙ]HØÙÜÒQY[ÝHZÙBBIÌÍÜYHØÙÜÑ^ÝÊ   ÌÎNÔÜ]ÛYØÙÜË^IÌÎNÊBBNÈÈÛÛY][ÈÚ]Ü]ÛYØÙÜÈÚ[ÝÜÈ]ÂBNÈBTØÙÜÕØZ]ÛÜÙJ    ÌÍÜY
BQ[Y[[

You can mix it up how you like.

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...