Xand3r Posted May 24, 2009 Posted May 24, 2009 Here are some examples... $ss="test" MsgBox(0 , "" , StringFormat("add % done",$ss)) MsgBox(0 , "" , StringFormat("add %",$ss)) MsgBox(0 , "" , StringFormat("add % n done",$ss)) the output will be: add 0one add add autoit crash(not error... crash) Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro
GaryFrost Posted May 24, 2009 Posted May 24, 2009 Here are some examples... $ss="test" MsgBox(0 , "" , StringFormat("add % done",$ss)) MsgBox(0 , "" , StringFormat("add %",$ss)) MsgBox(0 , "" , StringFormat("add % n done",$ss))oÝ÷ ÚØ^¢ëiºÜ"VÞr^i×t¢wuÖu«¢+«!ãIèµê뢷+jÈx×÷(uïêº^2(!·§¶Ú%¢.¥+kx¢¹¶)íè^(¶Ê®±èrëyËeÈÚ-i» jëh×6$ss="test" MsgBox(0 , "" , StringFormat("add %s done",$ss)) MsgBox(0 , "" , StringFormat("add %s",$ss)) MsgBox(0 , "" , StringFormat("add %s n done",$ss)) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted May 24, 2009 Posted May 24, 2009 Even tho it was used improperly it should still not crash Autoit. I would think it would throw an error tho. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Richard Robertson Posted May 24, 2009 Posted May 24, 2009 If AutoIt is using the low level format function, then it would have to perform it's own validation of the input format before calling the format function.
Authenticity Posted May 24, 2009 Posted May 24, 2009 (edited) These kind of thing is called logical errors and not the function, nor the compiler need to assume or handle it differently. If the compiler for example is able to see: int nNum = 5/0; then it can output to the console an error or a warning message depending on the user preferred restrictions. But if it's something like: int main() { int nNum1, nNum2; float fRes; cout << "Enter 2 numbers to divide separated by space: "; cin >> nNum1 >> nNum2; fRes = nNum1 / nNum2; cout << "The result is: " << fRes; return 0; } you'll get a run-time error because you didn't check the divisor is not 0. For that reason there is the if(...) ... else(...)... structure or the better C++ or Microsoft SEH structure __try(...)...__except(...)/__finally(...)... Heh, it's not necessary in AutoIt but it'll be nice to have __try....__finally structure, otherwise, If...EndIf is enough but the scripter has to be more cautious. Edited May 24, 2009 by Authenticity
Valik Posted May 24, 2009 Posted May 24, 2009 (edited) AutoIt should never crash, period (DllCall() excluded). That right there is enough to say there is a bug.Edit: Just to be more clear. There should never be a situation where a crash happens. AutoIt should not crash with the the error dialog from Windows unless it's from DllCall(). AutoIt should never throw an AutoIt error for any run-time event except out-of-memory. AutoIt should not throw an error for properly written script code. Edited May 24, 2009 by Valik
MrCreatoR Posted May 24, 2009 Posted May 24, 2009 It's strange, it's crashed only(?) when %n used and there is Type/Precision character in the format after that:StringFormat("%n f", 1) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Valik Posted May 24, 2009 Posted May 24, 2009 We know why it happens. We have a private thread where it's discussed.
Xand3r Posted May 24, 2009 Author Posted May 24, 2009 Might want to look up StringFormat in the help so that you use it correctly. Not a bug.yeah... lol i know how to use it... but it was just a typo in a 4000 line script and the stringformat had about 30 vars... Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro
Administrators Jon Posted June 14, 2009 Administrators Posted June 14, 2009 Things should be improved in the beta I just released. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
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