Sign in to follow this  
Followers 0
wjp79

adlib function

4 posts in this topic

Hello

I'm using autoit for a couple of weeks now, so I'm new here...

I'm using autoit for automatic software installation.

Now I would like to add a way to quit the script when a program is already installed.

As an example I have vlc player script

I have noticed another script that uses adlib to execute command if a specific window may appear.

But this does not seem to work.

I'v searched the forums and used differend expamples from other scripts.

Any advise?

Sorry for my bad English...

$run1 = Run('\\server1\software\INSTALLEREN-autoit\exe\vlc-0.9.9-win32.exe')

$titel = "VLC media player 0.9.9-installatie"

; selecteer taal.

If WinWait("Installer Language", "Please select a language", 60) Then

ControlClick("Installer Language", "Please select a language", "Button1")

; Start checking for a license window during installation

ConsoleWrite("in __Adlib" & @CR)

ConsoleWrite("in __Adlib2" & @CR)

AdlibEnable('_Adlib')

AdlibEnable('_Adlib2')

; Welcome to the VideoLAN VLC media player 0.8.6d Setup Wizard

WinWait($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard")

ControlClick($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard", "Button2")

; Choose Components

WinWait($titel, "Onderdelen kiezen")

ControlClick($titel, "Onderdelen kiezen", "Button2")

; Choose Install Location

WinWait($titel, "Installatielocatie kiezen")

ControlClick($titel, "Installatielocatie kiezen", "Button2")

; Completing the VideoLAN VLC media player 0.8.6d Setup Wizard

WinWait($titel, "Voltooien van de VLC media player 0.9.9-installatiewizard")

ControlCommand($titel, "Voltooien van de VLC media player 0.9.9-installatiewizard", "Button4", "UnCheck")

ControlClick($titel, "Voltooien van de VLC media player 0.9.9-installatiewizard", "Button2")

; Stop checking for a license window

AdlibDisable()

; Continue when setup process has finished

ProcessWaitClose($run1)

EndIf

Exit

Func _Adlib2()

If WinExists($titel, "VLC mediaspeler is reeds geinstalleerd. Wilt u de vorige versie verwijderen voordat u VLC media player 0.9.9 installeert ?") Then

ControlClick($titel, "VLC mediaspeler is reeds geinstalleerd. Wilt u de vorige versie verwijderen voordat u VLC media player 0.9.9 installeert ?", "Button3")

EndIf

if WinExists($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard") Then

ControlClick($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard", "Button3")

EndIf

If WinExists($titel, "Weet u zeker dat u de VLC media player 0.9.9-installatie wilt afsluiten?") Then

ControlClick($titel, "Weet u zeker dat u de VLC media player 0.9.9-installatie wilt afsluiten?", "Button1")

EndIf

EndFunc

Func _Adlib1()

; License Agreement

If WinExists($titel, "Licentieovereenkomst") Then

ControlClick($titel, "Licentieovereenkomst", "Button2")

EndIf

EndFunc

Share this post


Link to post
Share on other sites



wjp79,

A small problem, you can only have 1 Adlib running at a time. ;-)

If you want to check for 2 things, you can use Adlib to set up a switching function:

; Credit to PsaltyDS for this example

Global $iDelay_1 = 1000, $iTimer_1 = TimerInit()
Global $iDelay_2 = 2000, $iTimer_2 = TimerInit()

HotKeySet("{ESC}", "_Quit")
AdlibEnable("_Switching", 100)

While 1
    Sleep(50)
WEnd

Func _Switching()
    If TimerDiff($iTimer_1) >= $iDelay_1 Then
        $iTimer_1 = TimerInit()
        ConsoleWrite("Timer_1:  " & $iDelay_1 & "ms" & @LF)
    EndIf
    
    If TimerDiff($iTimer_2) >= $iDelay_2 Then
        $iTimer_2 = TimerInit()
        ConsoleWrite("Timer_2:  " & $iDelay_2 & "ms" & @LF)
    EndIf
EndFunc

Func _Quit()
    Exit
EndFunc

You could put your 2 checks for the license window in place of the timer checks.

I hope this helps.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

As mentioned you can only have one adlib function at a time. This UDF allows you to have several, though it may be overkill for this task:

http://www.autoitscript.com/forum/index.php?showtopic=83967

Is there a reason why you can't just have one adlib function?

Func _Adlib1()
If WinExists($titel, "VLC mediaspeler is reeds geinstalleerd. Wilt u de vorige versie verwijderen voordat u VLC media player 0.9.9 installeert ?") Then
ControlClick($titel, "VLC mediaspeler is reeds geinstalleerd. Wilt u de vorige versie verwijderen voordat u VLC media player 0.9.9 installeert ?", "Button3")
EndIf

if WinExists($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard") Then
ControlClick($titel, "Welkom bij de VLC media player 0.9.9-installatiewizard", "Button3")
EndIf

If WinExists($titel, "Weet u zeker dat u de VLC media player 0.9.9-installatie wilt afsluiten?") Then
ControlClick($titel, "Weet u zeker dat u de VLC media player 0.9.9-installatie wilt afsluiten?", "Button1")
EndIf

; License Agreement
If WinExists($titel, "Licentieovereenkomst") Then
ControlClick($titel, "Licentieovereenkomst", "Button2")
EndIf
EndFunc
Edited by TurionAltec

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you for the fast reply

Well in this particular installation sometimes in a fresh installation of vlc a registration window comes up.

But I also would like to have some code what if vlc is already installed.

But I tested it with 1 adlib, but this does not seems to work either. (have to figure that one out first)

Also if the software is installed on vista.. the installation could be different. (experienced it with adobe reader)

(am i making any sence here?)

TNX is advance

WJP79

Edited by wjp79

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