ProgAndy Posted April 24, 2012 Share Posted April 24, 2012 It has unexpected consequences (well, in pathalogical uses the help file warns against):And with the new ternary operator we do not have to rely on this sluggish conversion. (1=1)?1:0 ist much cleaner James 1 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 24, 2012 Share Posted April 24, 2012 (edited) Trust me on this: You're wasting your time. Maybe come back and try again in a year. Right now, though? Not such a good time to try that.Understood. (Im not really up to the point of adding function pointers ATM, but I should be at that stage in two or three months, im sure I can delay it more though.) Edited April 24, 2012 by twitchyliquid64 ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
ProgAndy Posted April 24, 2012 Share Posted April 24, 2012 (edited) Understood. (Im not really up to the point of adding function pointers ATM, but I should be at that stage in two or three months, im sure I can delay it more though.)Only implement functionality from stable or at least beta releases. Everything else is subject to change and you will never get it right. Edited April 24, 2012 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
jchd Posted April 24, 2012 Share Posted April 24, 2012 (edited) Andy, That's why I wrote "pathological". But Valik gave the reason. BTW and while I think about it, I sometimes find it useful to have a built-in Sign() function valued in {-1, 0, 1}. Not a great feature and certainly not a complex addition to the core(*) but it would make the language more complete wrt basic arithmetic. Edit: here I meant "the core functions" not the language engine of course. Edited April 24, 2012 by jchd This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Raik Posted April 24, 2012 Share Posted April 24, 2012 The $ in variables is now optional. If you want to continue using $ to prefix your variables that is fine and will continue to be supported. If you'd rather drop the $ that is fine, too, though be aware you cannot have variables with the same name as functions unless you prefix the variable with $.with my limited knowledge about the program logic behind this, will this not break scripts like this? Opt('ExpandVarStrings',1) $does="does not" #cs some other code ... #ce $not=" not" If someFunc() <> 0 Then $not="" EndIf $cmd_line_for_external_program=" /say 'This does$not work!'" Is this a feature for lazy programing or is it a prearrangement for new programing techniques? if so, i hope, autoit will not become a complex and cryptic high-level-language as c++ alike. AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Valik Posted April 24, 2012 Author Share Posted April 24, 2012 Your code should work as expected because you didn't write it in a way that it would potentially break. I think I know what you were going for however. So with that in mind... ExpandVarStrings is stupid (as all are Opt()'s) and I don't really give a damn if it's broken or not. I imagine we can force ExpandVarStrings to only expand prefixed variables, though. Assuming it doesn't already. Link to comment Share on other sites More sharing options...
veronesi Posted April 24, 2012 Share Posted April 24, 2012 Hi!The new C++ style ternary operators are really impressive!In this case it could replace the _Iif command! The code would be very clean and in one line.Global Const $sPhone1 = "+41 44 1111111" Global Const $sPhone2 = "+41 44 2222222" Global $iSelector = 1 MsgBox(64, "Info", "Please call " & ($iSelector = 1) ? $sPhone1:$sPhone2)Really nice and well done.Veronesi Link to comment Share on other sites More sharing options...
Kip Posted April 24, 2012 Share Posted April 24, 2012 (edited) Hi! The new C++ style ternary operators are really impressive! In this case it could replace the _Iif command! The code would be very clean and in one line. Global Const $sPhone1 = "+41 44 1111111" Global Const $sPhone2 = "+41 44 2222222" Global $iSelector = 1 MsgBox(64, "Info", "Please call " & ($iSelector = 1) ? $sPhone1:$sPhone2) Really nice and well done. Veronesi An array would be even "cleaner": Global Const $aPhones[] = ["+41 1234567", "+41 987654"] MsgBox(64, "info", "Please call "& $aPhones[1] ) Edited April 24, 2012 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
veronesi Posted April 24, 2012 Share Posted April 24, 2012 That's right. But nevertheless you can use the new C++ style ternary operators MsgBox(64, "Info", "Please call " & ($iSelector = 1) ? $asNumbers[0]:$asNumbers[1]) Link to comment Share on other sites More sharing options...
Valik Posted April 24, 2012 Author Share Posted April 24, 2012 (edited) This is why Jon didn't want to add ternary operators. If you do not know how to use them they make the code worse. I softened him somewhat on them by using them (correctly) to write AutoIt. Seeing code like that causes me to regret giving the green light to the feature, though. Edited April 24, 2012 by Valik Mat and James 2 Link to comment Share on other sites More sharing options...
Zedna Posted April 24, 2012 Share Posted April 24, 2012 @Valik Maybe it would be good to mention some basic advice for correct using of ternary operators in Documentation. I expect most of Autoit's users are not familiar with such programming techniques. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
trancexx Posted April 24, 2012 Share Posted April 24, 2012 Problems with misuse or abuse of ternary is not (will not be) AutoIt specific. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Valik Posted April 24, 2012 Author Share Posted April 24, 2012 Operators like ternary are not added to teach people new tricks. They are added so that people who know about them and expect them can use them. The only way we can teach people not to write shit code is to not demonstrate shit code in the examples. That's why I want most of the examples revised which guinness has been working on. Link to comment Share on other sites More sharing options...
guinness Posted April 24, 2012 Share Posted April 24, 2012 (edited) Yeh and will be complete by the next stable version for those who are interested. Edited April 24, 2012 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
czardas Posted April 24, 2012 Share Posted April 24, 2012 I always had a firm belief in ternary. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
NJJudUser Posted May 23, 2012 Share Posted May 23, 2012 We have the new BETA and we are having some issues with WinWaitActive function on Windows 7 64 bit. Is there some other "include" that we need to have in order for this to work on windows 7? Link to comment Share on other sites More sharing options...
NJJudUser Posted May 23, 2012 Share Posted May 23, 2012 I am sorry for posting this in this space because, as a newly registered user, i do not have the ability to start new posts. Link to comment Share on other sites More sharing options...
Valik Posted May 23, 2012 Author Share Posted May 23, 2012 Maybe that's because you're in the wrong area completely? Link to comment Share on other sites More sharing options...
MvGulik Posted May 25, 2012 Share Posted May 25, 2012 #383 ... Interesting. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Shaggi Posted May 28, 2012 Share Posted May 28, 2012 If you decide to keep the ternaries, here's a small bug. dummy = random(0,1,1) ? b() : c() ; works random(0,1,1) ? b() : c() ; won't Autoit throws errors if you don't catch the return - this isn't the case with functions or the like. Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG 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