FreeBeing 3 Posted April 9, 2011 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 : expandcollapse popup#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 Share this post Link to post Share on other sites
Jos 2,209 Posted April 9, 2011 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. Share this post Link to post Share on other sites
sahsanu 28 Posted April 9, 2011 (edited) 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 April 9, 2011 by sahsanu Share this post Link to post Share on other sites
FreeBeing 3 Posted April 9, 2011 Thank you, it works ! Share this post Link to post Share on other sites