Jump to content

Bug in my script I don't understand


Recommended Posts

Hi,

I added to my script conditions to check if we use XP or Vista or 7, but it don't work.

I get error :

G:\AutoIt>Au3Check.exe raccourcis_clavier.au3

AutoIt3 Syntax Checker v1.54.8 Copyright © Tylo 2007

G:\AutoIt\raccourcis_clavier.au3(27,2) : ERROR: missing EndIf.

Func

^

G:\AutoIt\raccourcis_clavier.au3(25,33) : REF: missing EndIf.

If (@OSVersion == "WIN_XP") Then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

G:\AutoIt\raccourcis_clavier.au3(30,2) : ERROR: syntax error

EndIf

^

raccourcis_clavier.au3 - 2 error(s), 0 warning(s)

My script :

#NoTrayIcon
EnvSet("SEE_MASK_NOZONECHECKS", 1)

;Raccourcis clavier
HotKeySet("^!t", "Taches")
Func Taches()
    ShellExecute("taskmgr")
EndFunc
HotKeySet("^!p", "Peripheriques")
Func Peripheriques()
    ShellExecute("devmgmt.msc")
EndFunc
HotKeySet("^!c", "cmd")
Func cmd()
    ShellExecute("cmd", "", @ScriptDir)
EndFunc

;Partie Aida64
HotKeySet("^!a", "Aida64")
Func Aida64()
    ShellExecute("aida64.exe", "", @ScriptDir & "\..\Majs_Commun\aida64")
EndFunc
;Fin partie Aida64

If (@OSVersion == "WIN_XP") Then
    HotKeySet("^!s", "SolitaireXP")
    Func SolitaireXP()
        ShellExecute("sol.exe")
    EndFunc
    HotKeySet("^!d", "DemineurXP")
    Func DemineurXP()
        ShellExecute("winmine.exe")
    EndFunc
EndIf

If (@OSVersion == "WIN_VISTA") Or (@OSVersion == "WIN_7") Then
    HotKeySet("^!s", "Solitaire")
    Func Solitaire()
        ShellExecute(@ProgramFilesDir & "\Microsoft Games\Solitaire\Solitaire.exe")
    EndFunc
    HotKeySet("^!d", "Demineur")
    Func Demineur()
        ShellExecute(@ProgramFilesDir & "\Microsoft Games\Minesweeper\Minesweeper.exe")
    EndFunc
EndIf
;Fin raccourcis clavier

;Dodo
While 1
    Sleep(120000)
WEnd
;Fin Dodo boucle

Maybe an idea ?

Thank you :)

Link to comment
Share on other sites

  • Developers

Move your functions (FUNC-ENDFUNC) to the end of the script in stead of putting them inside of an IF-ENDIF

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

Maybe an idea ?

Yes, don't use Func inside an If. No matter what you do, ALL Funcs will be read at compiling time. So, put the Funcs outside Ifs and your script will work.

Edit: I'm always 30 seconds late :)

Edited by sahsanu
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...