crashdemons Posted March 20, 2008 Posted March 20, 2008 (edited) A Quine is a program that can output it's own source without having direct access or user intervention.(This Means no reading of the script file, prompting for source input, packaging the source, or using inbuilt source references)A Quine is not necessarily malicious or self-duplicating, but rather an attempt at a theory.Definition of Quine Why torture ourselves making this this way? The reason is to [re]prove a concept of computing: that it is possible for a turing-complete language to output it's own source-code. (or optionally, output a program in another language that outputs the original source code; aka. a multiquine ) Here, are some AutoIt3 Quines: My Quines:One-line quines from my reply on Page 2:ConsoleWrite(StringReplace("ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))MsgBox(0,'',StringReplace("MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))Old 2-Line Quine:$x="$x=%srnMsgBox(0,'Quine Example',StringFormat($x,Chr(34)&$x&Chr(34)))" MsgBox(0,'Quine Example',StringFormat($x,Chr(34)&$x&Chr(34)))Skeleton/Customizable Quine (Page 2)Global $gsQuine eq("MsgBox(0,'program','first exec line')") eq("MsgBox(0,'program','second exec line')") Func eq($s) Execute($s) $gsQuine&=BinaryToString(0x22287165)&$s&BinaryToString(0x0A0D2922) EndFunc $x="Global $gsQuinern%sFunc eq($s)rnExecute($s)rn$gsQuine&=BinaryToString(0x22287165)&$s&BinaryToString(0x0A0D2922)rnEndFuncrn$x=%srnMsgBox(0,'Quine Example',StringFormat($x,$gsQuine,Chr(34)&$x&Chr(34)))" MsgBox(0,'Quine Example',StringFormat($x,$gsQuine,Chr(34)&$x&Chr(34)))Any Questions? Quines by Michel Claveau:$x="MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)" MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)$g=chr(34) $x="MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)" MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x) Images of past quines: - - - And for my next magic trick - an AutoIt3 / PHP Polyglot (non-quine and all too simple)A Polyglot is a script that can perform the same actions in multiple languages without manipulation of the code.;=- <?php ;/* ConsoleWrite(";=- Hello World -=;"); ;*/ ; echo "Hello World"; ; ?> -=;In either language, this outputs ";=- Hello World -=;" to the console. Edited September 7, 2011 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
monoceres Posted March 26, 2008 Posted March 26, 2008 (edited) Sorry for bumping, but I just had to. Just read the wikpedia page on Quine and thought to myself: Hey! Wonder if it have been done in autoit? And indeed it had! Very nice work (and in only 2 lines) Edited March 26, 2008 by monoceres Broken link? PM me and I'll send you the file!
-Ultima- Posted March 26, 2008 Posted March 26, 2008 You've actually got a stray $ in there (hint: before 'MsgBox' in the string $x). Nice, though [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]
Merovingian Posted March 26, 2008 Posted March 26, 2008 (edited) Is this correct?Ugh huh you bet its correct *Grinz*if in doubt read Quine Definition Edited March 26, 2008 by Gargy 01000001 01110101 01110100 01101111 01001001 01110100 00100000An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
NELyon Posted March 26, 2008 Posted March 26, 2008 I thought the point was to output the whole source. There it only goes up to "MsgBox(0, 'Quine"
Merovingian Posted March 26, 2008 Posted March 26, 2008 (edited) I thought the point was to output the whole source. There it only goes up to "MsgBox(0, 'Quine"You might have a vaild point there lets wait for Crashlulz*edit to conform Edited March 26, 2008 by Gargy 01000001 01110101 01110100 01101111 01001001 01110100 00100000An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
weaponx Posted March 26, 2008 Posted March 26, 2008 (edited) First: Stop centering the text in the posts, are newspapers and books center justified? No.Second: Just include the entire source code using FileInstall() - or -Using a preprocessor directive:#AutoIt3Wrapper_res_SaveSourceSee other options:http://www.autoitscript.com/forum/index.ph...install++source Edited March 26, 2008 by weaponx
Tomb Posted March 26, 2008 Posted March 26, 2008 You might have a vaild point there lets wait for Crashlulzyour signature is soo big it makes the page have a sidewards scroollbar.
monoceres Posted March 26, 2008 Posted March 26, 2008 That depends on how big screen you have Broken link? PM me and I'll send you the file!
crashdemons Posted March 26, 2008 Author Posted March 26, 2008 (edited) Wow! don't think I've ever gotten this many replies. Um yeah I think the $ before MsgBox was a typo when I was removing lines from it - I'll go fix it now. Also, I'd be pleased if someone can make a different example - although StringFormat is certainly easier than anything else I could think of. wrapping the string in a function to try one-line makes it complicated, ugh because you have to repeat it 2+ etc.... *shrugs* Let me know... Shorter version of the "PHP/AutoIt" Polyglot (Editbox is broken on the first post) ;=- <?php /* ConsoleWrite(";=- Hello World -=;");*/ echo "Hello World"; ?> -=; PS: I don't know exactly why it was only partially outputting for some - but just in case, try the newest edit that removed the extra '$' before MsgBox -- also I noticed the icon on the dialog box where the problem is, I suppose it's possible there might be a compatibility issue with WINE? I don't know. Edited March 27, 2008 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
Michel Claveau Posted March 27, 2008 Posted March 27, 2008 (edited) Hi! This release, without the StringFormat: $x="MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)" MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x) Variante: $g=chr(34) $x="MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)" MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x) _ Edited March 27, 2008 by Michel Claveau
crashdemons Posted March 27, 2008 Author Posted March 27, 2008 Cool! that works good My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
WolfWorld Posted March 28, 2008 Posted March 28, 2008 Wait you want run autoit on linux with wine ?? i tried for years and fail Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets!
weaponx Posted March 28, 2008 Posted March 28, 2008 I am failing to see how this would be useful, you have to replicate every line of commands for running and outputting to the user. If you used something like this below you only have to define the code once: $var = 'MsgBox(0,"","TEST")' ;Escape double quotes $var = StringReplace($var, '"', '""') ;Format run command $runCMD = StringFormat('"%s" /AutoIt3ExecuteLine "%s"', @AutoItExe, $var) RunWait($runCMD)
NELyon Posted March 28, 2008 Posted March 28, 2008 Wait you want run autoit on linux with wine ?? i tried for years and failI've been running Autoit under wine for around 8 Months now @Weaponx:I don't believe there is supposed to be a point. I think it's more of a "See if I can" type of thing.
Skrip Posted May 1, 2008 Posted May 1, 2008 Sorry for bump, but can this output source as the line is called? Like, script is on line 1, it shows only line 1, then it moves to 2, ect... [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
crashdemons Posted May 14, 2008 Author Posted May 14, 2008 (edited) Sorry for bump, but can this output source as the line is called?Like, script is on line 1, it shows only line 1, then it moves to 2, ect...do you want line 2 to output line 2 and line 3 to output line 3 ?that sounds very difficult Edited May 14, 2008 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
crashdemons Posted May 14, 2008 Author Posted May 14, 2008 here are two One-Line-Quines for Console and MsgBox ConsoleWrite(StringReplace("ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34))) MsgBox(0,'',StringReplace("MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34))) My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
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