Wooltown Posted January 11, 2007 Share Posted January 11, 2007 Opt("GUIOnEventMode", 1) ; Change to OnEvent mode HotKeySet("^s","Save") HotKeySet("^t","TestSave1") HotKeySet("^u","TestSave2") While 1 Sleep (1000) Wend Func Save($parameter = 0) msgbox(0,"Parameter",$parameter) EndFunc Func TestSave1() Save() EndFunc Func TestSave2() Save(2) EndFunc When I run this script and Pres Ctrl+S, I directly calls the Save function, and then AutoIT says "Error: Variable used without being declared.", but if it's called via TestSave1 or TestSave2 functions it work, is this a correct behaviour ?? The same behaviour is found when using GUiCtrlSetOnEvent. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 11, 2007 Developers Share Posted January 11, 2007 no errors here.. I would be helpful when more info is given... maybe a cut&paste of the SciTE outputpane so we can check the exact errors and running version ? 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 More sharing options...
xcal Posted January 11, 2007 Share Posted January 11, 2007 (edited) I get the same error:Error: Variable used without being declaredmsgbox(0,"Parameter",$parameter)msgbox(0,"Parameter",^ ERRORedit - btw, running 3.2.2.0 Edited January 11, 2007 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Wooltown Posted January 11, 2007 Author Share Posted January 11, 2007 (edited) Opt("GUIOnEventMode", 1); Change to OnEvent mode HotKeySet("^s","Save") HotKeySet("^t","TestSave1") HotKeySet("^u","TestSave2") While 1 Sleep (1000) Wend Func Save($parameter = 0) msgbox(0,"Parameter",$parameter) EndFunc Func TestSave1() Save() EndFunc Func TestSave2() Save(2) EndFunc When I run this script and Pres Ctrl+S, I directly calls the Save function, and then AutoIT says "Error: Variable used without being declared.", but if it's called via TestSave1 or TestSave2 functions it work, is this a correct behaviour ?? The same behaviour is found when using GUiCtrlSetOnEvent. Sorry forgot Win 2000 Sp4; AutoIT: 3.2.2.0 Output from SciTe >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "G:\Test system\Scripts\Development\Parm.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams >Running AU3Check (1.54.6.0) params: from:C:\Program Files\AutoIt3 +>AU3Check ended.rc:0 >Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "G:\Test system\Scripts\Development\Parm.au3" G:\Test system\Scripts\Development\Parm.au3 (9) : ==> Variable used without being declared.: msgbox(0,"Parameter",$parameter) msgbox(0,"Parameter",^ ERROR +>AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 6.816 Edited January 11, 2007 by Wooltown Link to comment Share on other sites More sharing options...
Developers Jos Posted January 11, 2007 Developers Share Posted January 11, 2007 Ok, now I understand ...This is a feature of AutoIt3.The parameter fields are not initialised when called that way. This was posted several times before ... eg http://www.autoitscript.com/forum/index.ph...otkey+parameter 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 More sharing options...
Wooltown Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks for the answer, but I think it is a strange "feature", but it is easy to bypass the feature via another function call. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now