jennico Posted January 3, 2009 Posted January 3, 2009 (edited) i found a piece of code from ModerMenuRaw ( by Holger ): ;********************************************************************** ; Get the icon ID like in newer Autoit versions ;********************************************************************** Func _GetIconID($nID, $sFile) If StringRight($sFile, 4) = ".exe" Then If $nID < 0 Then $nID = -($nID + 1) ElseIf $nID > 0 Then $nID = -$nID EndIf ElseIf StringRight($sFile, 4) = ".icl" And $nID < 0 Then $nID = -($nID + 1) Else If $nID > 0 Then $nID = -$nID ElseIf $nID < 0 Then $nID = -($nID + 1) EndIf EndIf Return $nID EndFunc ;==>_GetIconIDoÝ÷ ÛZ·l²î|¬¦¥z»kÊØb±«¢+ØÀÌØí¥±ôÅÕ½Ðí¡©¨¹±°ÅÕ½Ðì(ÀÌØí¥½¸ô´Ø()5Í ½à À°}Ñ%½¹% ÀÌØí¥½¸°ÀÌØí¥±¤°}Ñ%½¹%È ÀÌØí¥½¸°ÀÌØí¥±¤¤()Õ¹}Ñ%½¹%È ÀÌØí¹%°ÀÌØíÍ¥±¤(%IÑÕɸ´ÀÌØí¹%´ ÀÌØí¹%±ÐìÀ¤)¹Õ¹ìôôÐí}Ñ%½¹%È((쨨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨(ìÐÑ¡¥½¸%±¥¥¸¹ÝÈÕѽ¥ÐÙÉÍ¥½¹Ì(쨨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨)Õ¹}Ñ%½¹% ÀÌØí¹%°ÀÌØíÍ¥±¤(%%MÑÉ¥¹I¥¡Ð ÀÌØíÍ¥±°Ð¤ôÅÕ½Ðì¹áÅÕ½ÐìQ¡¸($%%ÀÌØí¹%±ÐìÀQ¡¸($$$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤($%±Í%ÀÌØí¹%ÐìÀQ¡¸($$$ÀÌØí¹%ô´ÀÌØí¹%($%¹%(%±Í%MÑÉ¥¹I¥¡Ð ÀÌØíÍ¥±°Ð¤ôÅÕ½Ðì¹¥°ÅÕ½Ðì¹ÀÌØí¹%±ÐìÀQ¡¸($$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤(%±Í($%%ÀÌØí¹%ÐìÀQ¡¸($$$ÀÌØí¹%ô´ÀÌØí¹%($%±Í%ÀÌØí¹%±ÐìÀQ¡¸($$$ÀÌØí¹%ô´ ÀÌØí¹%¬Ä¤($%¹%(%¹%($(%IÑÕɸÀÌØí¹%)¹Õ¹ìôôÐí}Ñ%½¹% anyone found similar things ? j. Edited January 3, 2009 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
BrettF Posted January 3, 2009 Posted January 3, 2009 I think I'm missing some bits. First off I can't see anything funny. Second why is this developer chat? IMO its better suited to chat. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Valik Posted January 3, 2009 Posted January 3, 2009 Ehh, funny? No. Code that obviously wasn't optimized? Yes. But we all write unoptimized code. That doesn't make it funny. All that I see wrong with the code and presumably what the OP finds "funny" is the fact that the function can be re-written to: Func _GetIconID($nID, $sFile) If $nID > 0 Then $nID = -$nID ElseIf $nID < 0 Then $nID = -($nID + 1) EndIf Return $nID EndFunc ;==>_GetIconIDObviously much shorter and as far as I can tell functionally equivalent. It can still be further reduced but that just starts adding confusion to a bit of code that's already confusing enough.
Flam Posted January 3, 2009 Posted January 3, 2009 You've been on your computer too long for one sitting :/ Happens.
jennico Posted January 4, 2009 Author Posted January 4, 2009 Func _GetIconID2($nID, $sFile) Return -$nID - ($nID < 0) EndFunc ;==>_GetIconID2 maybe you missed out the last abbreviation to the code. better stay serious and humorless, smiling harms !!!! the other chat Brett probably means, is: Chat General non-AutoIt chat. j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
Valik Posted January 4, 2009 Posted January 4, 2009 Func _GetIconID2($nID, $sFile) Return -$nID - ($nID < 0) EndFunc;==>_GetIconID2 maybe you missed out the last abbreviation to the code. better stay serious and humorless, smiling harms !!!! the other chat Brett probably means, is: j.You're right, I didn't see it. Now that I do I'll comment: it's bad code. The comparison $nID < 0 returns a boolean value, not a numeric value. We make no guarantee what the value of True and False is numerically. So the original, verbose code is better than yours because it will work correctly and doesn't rely on an unguaranteed boolean to numeric conversion.
jvanegmond Posted January 4, 2009 Posted January 4, 2009 You're right, I didn't see it. Now that I do I'll comment: it's bad code. The comparison $nID < 0 returns a boolean value, not a numeric value. We make no guarantee what the value of True and False is numerically. So the original, verbose code is better than yours because it will work correctly and doesn't rely on an unguaranteed boolean to numeric conversion.You've just made this thread a whole lot more funny. github.com/jvanegmond
JRowe Posted January 6, 2009 Posted January 6, 2009 You're all nerds, lol. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
Recommended Posts