Sign in to follow this  
Followers 0
coucou

Help getting ride from IF error

9 posts in this topic

Hi,

I've wrote a long time ago an AutoIt script for Divx 7.2 silent Install and it works just fine.

Since while, I've an invite for new update (update Right-now, tomorrow , in a month) and can't get ride from it. MSFN peopple advise to add the next script tp my (here bellow)attached own.

; Kill the update window pop-up (delete divx-bundle-updater.ini file from a folder inside %TEMP%)
#include <File.au3>
;#include <array.au3>
$avDirList = _FileListToArray(@TempDir, "ns*.tmp", 2)
;_ArrayDisplay($avDirList)
If IsArray($avDirList) Then
    For $n = 1 To $avDirList[0]
        $sPath = @TempDir & "\" & $avDirList[$n] & "\divx-bundle-updater.ini"
        If FileExists($sPath) Then
            FileDelete($sPath)
        EndIf
    Next
EndIf

Since I added the above script, I got the next error "If statement has no matching Endif"

divxautoiterror.jpg

I'll appreciate any help to get ride from tha If error.

Regards coucou

DivX_Install.au3

post-5679-12603719926647_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

the problem isn't your script, but your include file file.au3.

Line 44 is start of function Func _FileCountLines($sFilePath) and theres a faulty if statement.

I just add the file.au3 from version 3.3.0.0. Download it, put in your include folder of AutoIT, maybe with a different file name (e.g. file_test.au3). If you change file name, don't forget to change #include <file_test.au3>. Then test your file.

;-))

Stefan

File.au3

Edited by 99ojo

Share this post


Link to post
Share on other sites

TNX Stefan for yr reply Posted Image

I'm runing AutoIt 3.3 sibce last year.

I renamed File.au3 to file_test.au3 as well changed #include <file_test.au3> and puted it in the include folder of AutoIT

Unfortunately it doesn't help Posted Image

Still I've the same error.

Any more help be appreciated

coucou

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Run your script through Tidy to get an indication of the errors you made.

Opt('TrayIconDebug', 1)
$Pid = Run("DivXInstaller.exe")

; Start checking for six windows with "Updates detected", "Free! Include the Google Chrome web browser", "Stay updated with DivX through the FREE Yahoo! Toolbar",
; "Add the free Yahoo! Toolbar", "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Sign up for the DivX newsletter!" text
; inside them and for Internet Explorer, Mozilla Firefox, Opera and New Connection Wizard processes
AdlibEnable('_Adlib', 1000)
$title = "Installation de DivX for Windows"
$title1 = "DivX for Windows Setup"

If RegRead("HKCU\Control Panel\International", "sLanguage") = "FRA" Then

    ;Language
    If WinWait("Sélection de la langue", "", 10) Then
        ;ControlSetText("Sélection de la langue", "", "ComboBox1", "French")
        ControlSend("Sélection de la langue", "", "ComboBox1", "Français")
        Send("{SPACE}")
        ControlClick("Sélection de la langue", "", "Button1")
    EndIf

    ;Bienvenue
    WinWaitActive($title, "Bienvenue")
    ControlClick($title, "Bienvenue", "Button2")

    ;Licence
    WinWaitActive($title, "Licence utilisateur")
    ;ControlCommand($title, "Licence utilisateur", "Button4", "Check", "")
    ControlClick($title, "Licence utilisateur", "Button4")
    ControlClick($title, "Licence utilisateur", "Button2")

    ;Addenda
    ;WinWaitActive($title, "Addenda")
    ;ControlCommand($title, "Addenda", "Button4", "Check", "")
    ;ControlClick($title, "Addenda", "Button2")

    ;composants
    WinWaitActive($title, "Choisissez les composants")
    ControlClick($title, "Choisissez les composants", "Button2")

    ;destination
    WinWaitActive($title, "Choisissez le dossier")
    ;ControlSetText($title, "Choisissez le dossier", "Edit1", "C:\Program Files\DivX" )
    ControlClick($title, "Choisissez le dossier", "Button2")

    ;FIN
    WinWaitActive($title, "Installation terminée")
    Sleep(500)
    ControlClick($title, "Installation terminée", "Button4"); Associez MKV à DivX Player
    Sleep(500)
    ControlClick($title, "Installation terminée", "Button2")

    ;;WinWait($title, "Votre ordinateur doit être redémarré")
    ;;ControlClick($title, "Votre ordinateur doit être redémarré", "Button2")
    Sleep(500)


Else
    ;Language
    If WinWait("Language selection", "", 10) Then
        ControlClick("Language selection", "", "Button1")
    EndIf

    ;Welcome
    WinWaitActive($title1, "Welcome")
    ControlClick($title1, "Welcome", "Button2")

    ; Kill the update window pop-up (delete divx-bundle-updater.ini file from a folder inside %TEMP%)
    #include <File.au3>
    ;#include <array.au3>
    $avDirList = _FileListToArray(@TempDir, "ns*.tmp", 2)
    ;_ArrayDisplay($avDirList)
    If IsArray($avDirList) Then
        For $n = 1 To $avDirList[0]
            $sPath = @TempDir & "\" & $avDirList[$n] & "\divx-bundle-updater.ini"
            If FileExists($sPath) Then
                FileDelete($sPath)
            EndIf
        Next
    EndIf

    ;License
    WinWaitActive($title1, "License Agreement")
    ControlCommand($title1, "License Agreement", "Button4", "Check", "")
    ControlClick($title1, "License Agreement", "Button2")

    ;Addenda
    ;WinWaitActive($title1, "License Agreement Addenda")
    ;ControlCommand($title1, "License Agreement Addenda", "Button4", "Check", "")
    ;ControlClick($title1, "License Agreement Addenda", "Button2")

    ;components
    WinWaitActive($title1, "Choose Components")
    ControlClick($title1, "Choose Components", "Button2")

    ;Destination
    WinWaitActive($title1, "Choose Install Location")
    ;ControlSetText($title1, "Choose Install Location", "Edit1", "C:\Program Files\DivX" )
    ControlClick($title1, "Choose Install Location", "Button2")

    ;END
    WinWaitActive($title1, "Installation Complete")
    ;Sleep(500)
    ControlClick($title1, "Installation Complete", "Button4"); Associez MKV à DivX
    Sleep(500)
    ControlClick($title1, "Installation Complete", "Button2")
    Sleep(500)

EndIf
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndIf

Func _Adlib()
    ;French
    ; Norton™ Security Scan
    If WinExists($title, "Norton™ Security Scan") Then
        ControlCommand($title, "Norton™ Security Scan", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Norton™ Security Scan", "Button2", "left", 1, 37, 11)
    EndIf
    ;Mise à jour disponible
    If WinExists($title, "Mise à jour disponible") Then
        ControlClick($title, "Mise à jour disponible", "Button5");Non, je préfère installer cette ancienne version
        ControlClick($title, "Mise à jour disponible", "Button2")
    EndIf
    ; Free! Include the Google Chrome web browser
    If WinExists($title, "Google") Then
        ControlCommand($title, "Google", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Google", "Button2", "left", 1, 35, 8)
    EndIf
    ; Stay updated with DivX through the FREE Yahoo! Toolbar
    If WinExists($title, "Yahoo") Then
        WinActivate($title, "Yahoo")
        ControlCommand($title, "Yahoo", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Ajoutez la barre d'outils gratuite de Yahoo
    If WinExists($title, "Ajoutez la barre d'outils gratuite de Yahoo") Then
        WinActivate($title, "Ajoutez la barre d'outils gratuite de Yahoo")
        ControlCommand($title, "Ajoutez la barre d'outils gratuite de Yahoor", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Ajoutez la barre d'outils gratuite de Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free
    If WinExists($title, "IE7") Then
        WinActivate($title, "IE7")
        ControlCommand($title, "IE7", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "IE7", "Button2", "left", 1, 35, 8)
    EndIf
    ; Abonnez vous
    If WinExists($title, "Abonnez vous") Then
        WinActivate($title, "Abonnez vous")
        ControlClick($title, "Abonnez vous", "Button2", "left", 1, 35, 8)
        ;WinWaitClose($title, "Abonnez vous", 5)
    EndIf
    If WinExists($title, "Votre ordinateur doit être redémarré") Then
        WinActivate($title, "Votre ordinateur doit être redémarré")
        ControlClick($title, "Votre ordinateur doit être redémarré", "Button2")
    EndIf
    Sleep(500)

    ;English
    ; Norton™ Security Scan
    If WinExists("DivX for Windows Setup", "Norton™ Security Scan") Then
        ControlCommand("DivX for Windows Setup", "Norton™ Security Scan", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick("DivX for Windows Setup", "Norton™ Security Scan", "Button2", "left", 1, 37, 11)
    EndIf
    ;Updates
    If WinExists($title1, "Updates detected") Then
        ControlClick($title1, "Updates detected", "Button5");Non, je préfère installer cette ancienne version
        ControlClick($title1, "Updates detected", "Button2")
    EndIf
    ; Free! Include the Google Chrome web browser

    If WinExists($title1, "Free!") Then
        ControlCommand($title1, "Free!", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Free!", "Button2", "left", 1, 35, 8)
    EndIf
    ; Stay updated with DivX through the FREE Yahoo! Toolbar
    If WinExists($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar") Then
        WinActivate($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar")
        ControlCommand($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add the free Yahoo! Toolbar
    If WinExists($title1, "Add the free Yahoo") Then
        WinActivate($title1, "Add the free Yahoo")
        ControlCommand($title1, "Add the free Yahoo", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Add the free Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free
    If WinExists($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free") Then
        WinActivate($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free")
        ControlCommand($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Button2", "left", 1, 35, 8)
    EndIf
    ; Sign up for the DivX newsletter!
    If WinExists($title1, "Sign up") Then
        WinActivate($title1, "Sign up")
        ControlClick($title1, "Sign up", "Button2", "left", 1, 35, 8)
    EndIf
EndFunc   ;==>_Adlib

Sleep(3000)
ProcessWait("iexplore.exe")
For $i = 1 To 10 Step 1
    If ProcessExists("iexplore.exe") Then
        ProcessClose("iexplore.exe")
    Else
        ExitLoop
    EndIf
Next

Sleep(2000)
RunWait('RegEdit /S "Divx+Author7.reg"')

Exit
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Run your script through Tidy to get an indication of the errors you made.

I do not understand what do you mean Posted Image

Share this post


Link to post
Share on other sites

I do not understand what do you mean Posted Image

Make sure you have installed the full SciTE4AutoIt3 installer and do Ctrl+T (run Tidy)

That will give you the following warnings/errors in the output pane:

C:\test.au3(110) : ### Tidy Error: next line creates a negative tablevel.
C:\test.au3(111) : ### Tidy Error: next line creates a negative tablevel for the line after it.

Just double click them and it will show the lines.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hi,

I ran my script through Tidy and got the following indication of the errors:

>"C:\Program Files\AutoIt3\SciTE\tidy\tidy.exe" "C:\Test\DivxBundle\DivX_Instal.au3"
Tidy AutoIt3 v2.0.29.0   Copyright (c) Jos van der Zande  October 19, 2009
+> Tidy AutoIt3 finished. Original copied to:"C:\Test\DivxBundle\BackUp\DivX_Instal_old1.au3"
>Exit code: 0   Time: 0.491
NO errors found, it made the file tidy, BUT, still i have the same error Posted Image

here bellow attached the Tidy file.

coucou

DivX_Instal_Tidy.au3

Share this post


Link to post
Share on other sites

Hi,

Your code was messy. You should structure it more.

after resorting your code it seems to run. Although i can't test, i verify that after resorting your code no error comes up.

Beforehand they did.

#include <File.au3>
;#include <array.au3>

Opt('TrayIconDebug', 1)
$Pid=Run("DivXInstaller.exe")

; Start checking for six windows with "Updates detected", "Free! Include the Google Chrome web browser", "Stay updated with DivX through the FREE Yahoo! Toolbar",
; "Add the free Yahoo! Toolbar", "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Sign up for the DivX newsletter!" text
; inside them and for Internet Explorer, Mozilla Firefox, Opera and New Connection Wizard processes
AdlibEnable('_Adlib', 1000)
$title = "Installation de DivX for Windows"
$title1 = "DivX for Windows Setup"

If RegRead("HKCU\Control Panel\International", "sLanguage") = "FRA" Then

;Language
    If WinWait("Sélection de la langue", "", 10) Then
        ;ControlSetText("Sélection de la langue", "", "ComboBox1", "French")
        ControlSend("Sélection de la langue", "", "ComboBox1", "Français")
        Send("{SPACE}")
        ControlClick("Sélection de la langue", "", "Button1")
    EndIf

    ;Bienvenue
    WinWaitActive($title, "Bienvenue")
    ControlClick($title, "Bienvenue", "Button2")

    ;Licence
    WinWaitActive($title, "Licence utilisateur")
    ;ControlCommand($title, "Licence utilisateur", "Button4", "Check", "")
    ControlClick($title, "Licence utilisateur", "Button4")
    ControlClick($title, "Licence utilisateur", "Button2")

    ;Addenda
    ;WinWaitActive($title, "Addenda")
    ;ControlCommand($title, "Addenda", "Button4", "Check", "")
    ;ControlClick($title, "Addenda", "Button2")

    ;composants
    WinWaitActive($title, "Choisissez les composants")
    ControlClick($title, "Choisissez les composants", "Button2")

    ;destination
    WinWaitActive($title, "Choisissez le dossier")
    ;ControlSetText($title, "Choisissez le dossier", "Edit1", "C:\Program Files\DivX" )
    ControlClick($title, "Choisissez le dossier", "Button2")

    ;FIN
    WinWaitActive($title, "Installation terminée")
    Sleep(500)
    ControlClick($title, "Installation terminée", "Button4"); Associez MKV à DivX Player
    Sleep(500)
    ControlClick($title, "Installation terminée", "Button2")

    ;;WinWait($title, "Votre ordinateur doit être redémarré")
    ;;ControlClick($title, "Votre ordinateur doit être redémarré", "Button2")
    Sleep(500)

Else
    ;Language
    If WinWait("Language selection", "", 10) Then
        ControlClick("Language selection", "", "Button1")
    EndIf

    ;Welcome
    WinWaitActive($title1, "Welcome")
    ControlClick($title1, "Welcome", "Button2")

    ; Kill the update window pop-up (delete divx-bundle-updater.ini file from a folder inside %TEMP%)
    $avDirList = _FileListToArray(@TempDir, "ns*.tmp", 2)
    ;_ArrayDisplay($avDirList)
    If IsArray($avDirList) Then
        For $n = 1 To $avDirList[0]
            $sPath = @TempDir & "\" & $avDirList[$n] & "\divx-bundle-updater.ini"
            If FileExists($sPath) Then
                FileDelete($sPath)
            EndIf
        Next
    EndIf
EndIf
Sleep(3000)
ProcessWait("iexplore.exe")
For $i = 1 To 10 Step 1
    If ProcessExists("iexplore.exe") Then
        ProcessClose("iexplore.exe")
    Else
        ExitLoop
    EndIf
Next

Sleep(2000)
RunWait('RegEdit /S "Divx+Author7.reg"')

Exit

Func _Adlib()
   ;French
    ; Norton™ Security Scan
    If WinExists($title, "Norton™ Security Scan") Then
        ControlCommand($title, "Norton™ Security Scan", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Norton™ Security Scan", "Button2", "left", 1, 37, 11)
    EndIf
    ;Mise à jour disponible
    If WinExists($title, "Mise à jour disponible") Then
        ControlClick($title, "Mise à jour disponible", "Button5");Non, je préfère installer cette ancienne version
        ControlClick($title , "Mise à jour disponible", "Button2")
    EndIf
    ; Free! Include the Google Chrome web browser
    If WinExists($title, "Google") Then
        ControlCommand($title, "Google", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Google", "Button2", "left", 1, 35, 8)
    EndIf
    ; Stay updated with DivX through the FREE Yahoo! Toolbar
    If WinExists($title, "Yahoo") Then
        WinActivate($title, "Yahoo")
        ControlCommand($title, "Yahoo", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Ajoutez la barre d'outils gratuite de Yahoo
    If WinExists($title, "Ajoutez la barre d'outils gratuite de Yahoo") Then
        WinActivate($title, "Ajoutez la barre d'outils gratuite de Yahoo")
        ControlCommand($title, "Ajoutez la barre d'outils gratuite de Yahoor", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "Ajoutez la barre d'outils gratuite de Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free
    If WinExists($title, "IE7") Then
        WinActivate($title, "IE7")
        ControlCommand($title, "IE7", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title, "IE7", "Button2", "left", 1, 35, 8)
    EndIf
    ; Abonnez vous
    If WinExists($title, "Abonnez vous") Then
        WinActivate($title, "Abonnez vous")
        ControlClick($title, "Abonnez vous", "Button2", "left", 1, 35, 8)
        ;WinWaitClose($title, "Abonnez vous", 5)
    EndIf
    If WinExists($title, "Votre ordinateur doit être redémarré") Then
        WinActivate($title, "Votre ordinateur doit être redémarré")
        ControlClick($title, "Votre ordinateur doit être redémarré", "Button2")
    EndIf
Sleep(500)

   ;English
    ; Norton™ Security Scan
    If WinExists("DivX for Windows Setup", "Norton™ Security Scan") Then
        ControlCommand("DivX for Windows Setup", "Norton™ Security Scan", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick("DivX for Windows Setup", "Norton™ Security Scan", "Button2", "left", 1, 37, 11)
    EndIf
    ;Updates
    If WinExists($title1, "Updates detected") Then
        ControlClick($title1, "Updates detected", "Button5");Non, je préfère installer cette ancienne version
        ControlClick($title1, "Updates detected", "Button2")
    EndIf
    ; Free! Include the Google Chrome web browser

    If WinExists($title1, "Free!") Then
        ControlCommand($title1, "Free!", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Free!", "Button2", "left", 1, 35, 8)
    EndIf
    ; Stay updated with DivX through the FREE Yahoo! Toolbar
    If WinExists($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar") Then
        WinActivate($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar")
        ControlCommand($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Stay updated with DivX through the FREE Yahoo! Toolbar", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add the free Yahoo! Toolbar
    If WinExists($title1, "Add the free Yahoo") Then
        WinActivate($title1, "Add the free Yahoo")
        ControlCommand($title1, "Add the free Yahoo", "Button5", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Add the free Yahoo", "Button2", "left", 1, 35, 8)
    EndIf
    ; Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free
    If WinExists($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free") Then
        WinActivate($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free")
        ControlCommand($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Button4", "UnCheck", "")
        Sleep(500)
        ControlClick($title1, "Add Yahoo! Toolbar and IE7 Optimized for Yahoo! for free", "Button2", "left", 1, 35, 8)
    EndIf
    ; Sign up for the DivX newsletter!
    If WinExists($title1, "Sign up") Then
        WinActivate($title1, "Sign up")
        ControlClick($title1, "Sign up", "Button2", "left", 1, 35, 8)
    EndIf
EndFunc

;-))

Stefan

Share this post


Link to post
Share on other sites

It Works Posted Image

In fact, I just cut/paste at the top file

#include <File.au3>
;#include <array.au3>
... it was enough

TNX again

coucou

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