RazerM Posted May 5, 2006 Share Posted May 5, 2006 (edited) I don't expect it to be used for anything, just a proof of concept expandcollapse popup;=============================================================================== ; ; Program Name: Uranium ; Description:: Scripting Language ; Requirement(s): AutoIt Beta ; Author(s): RazerM ; ;=============================================================================== ; #include <GUIConstants.au3> #include <file.au3> #include <misc.au3> #Include <Array.au3> HotKeySet("{F5}", "_Run") HotKeySet("{F6}", "Comment") ;select line first Opt("TrayIconDebug", 1) $width = (@DesktopWidth/2)-6 $height = @DesktopHeight-65 $GUI = GUICreate("Uranium", $width, $height, 0, 0); BitOr($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZE)) $file = GUICtrlCreateMenu("&File") $save = GUICtrlCreateMenuItem("Save", $file) $open = GUICtrlCreateMenuItem("Open", $file) GUICtrlCreateMenuItem("", $file) $saveas = GUICtrlCreateMenuItem("Save As", $file) $program = GUICtrlCreateMenu("&Program") $run = GUICtrlCreateMenuItem("Run F5", $program) $stop = GUICtrlCreateMenuItem("Stop", $program) $clear = GUICtrlCreateMenuItem("Clear Output", $program) $input = GUICtrlCreateInput("", 0, 0, $width, $height, BitOr($GUI_SS_DEFAULT_EDIT,$ES_MULTILINE,$ES_AUTOVSCROLL,$ES_WANTRETURN,$ES_LEFT,$ES_AUTOHSCROLL)) GUISetState() ;output GUICreate("Uranium - Output", $width, $height, (@DesktopWidth/2), 0, -1, -1, $GUI) $output = GUICtrlCreateInput("", 0, 0, $width, $height, BitOr($GUI_SS_DEFAULT_EDIT,$ES_MULTILINE,$ES_AUTOVSCROLL,$ES_WANTRETURN,$ES_LEFT,$ES_AUTOHSCROLL)) GUISetState() GUICtrlSetFont($input, 10) ;output^ Opt("WinTitleMatchMode", 3) WinActivate("Uranium") Dim $progfile = "", $dir = @Desktopdir While 1 WinMove("Uranium", "", 0, 0) WinMove("Uranium - Output", "", (@DesktopWidth/2), 0) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $run _Run() Case $save If FileExists($progfile) = 0 Then $progfile = FileSaveDialog("Save", $dir, "Uranium Files (*.ccl)") _CheckExt($progfile, ".ccl") EndIf FileDelete($progfile) FileWrite($progfile, GUICtrlRead($input)) Case $open $progfile = FileOpenDialog("Open", $dir, "Uranium Files (*.ccl)") GUICtrlSetData($input, FileRead($progfile)) Case $saveas $progfile = FileSaveDialog("Save", $dir, "Uranium Files (*.ccl)") _CheckExt($progfile, ".ccl") FileDelete($progfile) FileWrite($progfile, GUICtrlRead($input)) Case $clear GUICtrlSetData($output, "") EndSwitch WEnd Func Comment() ;messy way of commenting lines If WinActive("Uranium") Then $old = ClipGet() Send("^x") $new = ClipGet() If StringLeft($new, 2) = "//" Then $new = StringTrimLeft($new, 2) Else $new = "//" & $new EndIf ClipPut($new) Send("^v") ClipPut($old) EndIf EndFunc ;==>Comment Func _Run() $multi = 0 If FileExists($progfile) = 0 Then $progfile = FileSaveDialog("Save", $dir, "Uranium Files (*.ccl)") FileWrite($progfile, GUICtrlRead($input)) EndIf $programcontent = StringSplit(GUICtrlRead($input),Chr(13)) FileDelete($progfile) FileWrite($progfile, GUICtrlRead($input)) $lines = _FileCountLines($progfile) Dim $variables[100] $variables[0] = "Variable List" WinActivate("Uranium - Output") FileCopy($progfile, $progfile & ".tmp", 1) $file = FileRead($progfile & ".tmp") FileDelete($progfile & ".tmp") FileWrite($progfile & ".tmp", $file) For $i = 1 To $lines $linecontent = StringStripWS(FileReadLine($progfile & ".tmp", $i), 1) If StringInStr($linecontent, ':= ') Then $assign = StringSplit($linecontent, ' := ', 1) If UBound($assign) <> 3 Then MsgBox(48,"Error", "Line " & $i & _ @CRLF & FileReadLine($progfile, $i) & @CRLF & _ "Syntax Error: Assignment incorrect") GUICtrlSetData($input, StringReplace(GUICtrlRead($input), FileReadLine($progfile, $i), FileReadLine($progfile, $i) & " < < < < < |||||||ERROR|||||||")) ExitLoop EndIf If StringRight($assign[2], 1) = '"' Then Assign($assign[1], StringTrimLeft(StringTrimRight($assign[2], 1), 1)) Else Assign($assign[1], $assign[2]) EndIf _ArrayAdd($variables, $assign[1]) $pos = _ArraySearch($variables, $assign[1]) _ArrayInsert($variables, $pos+1, Eval($assign[1])) $file = StringReplace($file, $assign[1], '"' & Eval($assign[1]) & '"') FileDelete($progfile & ".tmp") FileWrite($progfile & ".tmp", $file) EndIf If GUICtrlRead($output) = "" Then $crlf = "" If GUICtrlRead($output) <> "" Then $crlf = @CRLF If StringLeft($linecontent, 2) = "//" Then $ignore = 1 If (StringLeft($linecontent, 2) <> "//") And ($multi = 0) Then $ignore = 0 If StringLeft($linecontent, 6) = "End If" Then $ignore = 0 $multi = 0 EndIf If StringLeft($linecontent, 2) = "/*" Then $ignore = 1 $multi = 1 ElseIf StringLeft($linecontent, 2) = "*/" Then $ignore = 0 $multi = 0 ElseIf $ignore = 0 Then If StringLeft($linecontent, 3) = "CLS" Then GUICtrlSetData($output, "") If StringLeft($linecontent, 7) = 'print "' Then If StringInStr($linecontent, '";') Then $len = StringLen(_StringBetween($linecontent, 'print "', '"; ')) $newline = StringTrimRight(StringTrimLeft(StringReplace($linecontent, '"; "', ""), 7), 1) GUICtrlSetData($output, GUICtrlRead($output) & $crlf & $newline) Else GUICtrlSetData($output, GUICtrlRead($output) & $crlf & _StringBetween($linecontent, 'print "', '"')) EndIf ElseIf StringLeft($linecontent, 7) = "print $" Then MsgBox(48,"Error", "Line " & $i & _ @CRLF & FileReadLine($progfile, $i) & @CRLF & _ "Syntax Error: Variable not declared") ExitLoop EndIf If (StringLeft($linecontent, 6) = 'print ') And (StringLeft($linecontent, 7) <> 'print "') And (StringLeft($linecontent, 7) <> 'print $') Then If StringInStr($linecontent, '";') Then $len = StringLen(_StringBetween($linecontent, 'print ', '; ')) $newline = StringTrimRight(StringTrimLeft(StringReplace($linecontent, '"; "', ""), 7), 1) If StringIsDigit(StringTrimLeft($newline, 6)) = 0 Then GUICtrlSetData($output, GUICtrlRead($output) & $crlf & "Err: String is not a number") GUICtrlSetData($output, GUICtrlRead($output) & $crlf & Execute(StringTrimLeft($newline, 6))) Else If StringIsDigit(StringTrimLeft($linecontent, 6)) = 0 Then GUICtrlSetData($output, GUICtrlRead($output) & $crlf & "Err: String is not a number") GUICtrlSetData($output, GUICtrlRead($output) & $crlf & Execute(StringTrimLeft($linecontent, 6))) EndIf EndIf If StringInStr($linecontent, ':= "') Then $assign = StringSplit($linecontent, ' := "', 1) Assign($assign[1], StringTrimRight($assign[2], 1)) $variables[$i] = $assign[1] EndIf If (StringInStr($linecontent, ':= ')) And (StringInStr($linecontent, ':= "') = 0) Then $assign = StringSplit($linecontent, " := ", 1) If StringIsDigit($assign[2]) = 1 Then Assign($assign[1], $assign[2]) $variables[$i] = $assign[1] Else Assign($assign[1], "Err: Not a number") $variables[$i] = $assign[1] EndIf EndIf If StringLeft($linecontent, 8) = 'inputi "' Then $inputQ = _StringBetween($linecontent, 'inputi "', '"= ') $QuestionLen = StringLen($inputQ) GUICtrlSetData($output, GUICtrlRead($output) & $crlf & $inputQ) $old = GUICtrlRead($output) Do If GUIGetMsg() = $stop Then ExitLoop Until _IsPressed("0D") And (WinActive("Uranium - Output") = 1) Send("{Backspace}") $new = Execute(StringReplace(GUICtrlRead($output), $old, "")) Assign(StringTrimLeft($linecontent, (8+$QuestionLen+3)), $new) $replacedvar = StringReplace(FileRead($progfile & ".tmp"), StringTrimLeft($linecontent, (8+$QuestionLen+3)),$new) FileDelete($progfile & ".tmp") FileWrite($progfile & ".tmp", $replacedvar) $variables[$i] = StringTrimLeft($linecontent, (8+$QuestionLen+3)) EndIf If StringLeft($linecontent, 7) = 'input "' Then $inputQ = _StringBetween($linecontent, 'input "', '"= ') $QuestionLen = StringLen($inputQ) GUICtrlSetData($output, GUICtrlRead($output) & $crlf & $inputQ) $old = GUICtrlRead($output) Sleep(500) Do If GUIGetMsg() = $stop Then ExitLoop Until _IsPressed("0D") And (WinActive("Uranium - Output") = 1) Send("{Backspace}") $new = StringReplace(GUICtrlRead($output), $old, "") Assign(StringTrimLeft($linecontent, (7+$QuestionLen+3)), $new) $replacedvar = StringReplace(FileRead($progfile & ".tmp"), StringTrimLeft($linecontent, (7+$QuestionLen+3)),'"' & $new & '"') FileDelete($progfile & ".tmp") FileWrite($progfile & ".tmp", $replacedvar) $variables[$i] = StringTrimLeft($linecontent, (7+$QuestionLen+3)) EndIf If StringLeft($linecontent, 5) = 'Msg("' Then If StringInStr($linecontent, '";') Then $len = StringLen(_StringBetween($linecontent, 'print "', '"; ')) $newline = StringReplace($linecontent, '"; "', "") MsgBox(0,_StringBetween($linecontent, ',"', '")'),_StringBetween($newline, 'Msg("', '",')) Else MsgBox(0,_StringBetween($linecontent, ',"', '")'),_StringBetween($linecontent, 'Msg("', '",')) EndIf EndIf If StringLeft($linecontent, 6) = "Pause(" Then Sleep(_StringBetween($linecontent, "Pause(", ")")) EndIf If StringLeft($linecontent, 3) = "If " Then Select Case StringInStr($linecontent, " = ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " = ", 1) If ($condition[1] = $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " == ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " == ", 1) If ($condition[1] == $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " <> ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " <> ", 1) If ($condition[1] <> $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " < ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " < ", 1) If ($condition[1] < $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " > ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " > ", 1) If ($condition[1] > $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " >= ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " >= ", 1) If ($condition[1] >= $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf Case StringInStr($linecontent, " <= ") <> 0 $linestripped = StringReplace(StringTrimLeft(StringTrimRight($linecontent, 5), 3), '"', '') $condition = StringSplit($linestripped, " <= ", 1) If ($condition[1] <= $condition[2]) = False Then $ignore = 1 $multi = 1 EndIf EndSelect EndIf EndIf Next EndFunc ;==>_Run Func _StringBetween($s, $from, $to) $x = StringInStr($s, $from) + StringLen($from) $y = StringInStr(StringTrimLeft($s, $x), $to) Return StringMid($s, $x, $y) EndFunc ;==>_StringBetween Func _CheckExt(ByRef $s_file, $s_ext) If StringRight($s_file, StringLen($s_ext)) <> $s_ext Then $s_file = $s_file & $s_ext EndFunc ;==>_CheckExt after running put this in the left window and choose program>run expandcollapse popupinput "What age are you? "= $age input "What is your gender? "= $gender print "" print "Forename: "; $forename //print $forename print "Surname: "; $surname //print $surname print "Age: "; $age //print $age print "Gender: "; $gender //print $gender print "" print "All Info:" print $forename print $surname print $age print $gender print "" print "RazerM's info:" print $myforename print $mysurname print $myage print $mygender print "" If $forename = $myforename Then print "You have the same forename as RazerM!" End If If $surname = $mysurname Then print "You have the same surname as RazerM!" End If If $age = $myage Then print "You are the same age as RazerM!" End If If $gender = $mygender Then print "RazerM is also a Male!" End If //show math calculation using inputi print "" inputi "Enter a mathematical calculation.. "= $sum print $sum //pause for 2 seconds Pause(2000) //in milliseconds Msg($text; ", "; $forename,"Done") it shows all the functions Edited May 30, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
nfwu Posted May 6, 2006 Share Posted May 6, 2006 This reminds me of my old "command parser", just that this one does not understand expressions.#) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Pa Callender Posted May 6, 2006 Share Posted May 6, 2006 (edited) You beat me to this. I made two ideas, one based on a syntax like HTML (e.g. <if "life" "=life"><out "life is life"></if>) and one using inverted exclamation marks for processes and inverted question marks for IF statements. My mum prefered the inverted !'s & ?'s. But I just never got round to making a script that could decode (or whatever it's called - it's just after Doctor Who. My head is seriously mixed up. 2+2=5) the language. Ah well... Yours is most definately better than mine (who tries to make a screensaver based on the AutoIt Screensaver and adds a "Please wait..." screen??EDIT: ASutoIt > AutoIt Edited May 6, 2006 by Pa Callender [size="4"]YOU SHALL NOT PARSE!![/size] Link to comment Share on other sites More sharing options...
jvanegmond Posted September 17, 2006 Share Posted September 17, 2006 I just found this in your signature. I'm gonna cry, this is beautiful! github.com/jvanegmond Link to comment Share on other sites More sharing options...
RazerM Posted September 17, 2006 Author Share Posted September 17, 2006 I have actually rewritten the whole parsing element of the program. The Lexer is finished but Parsing is hard. Still working out functions and functions inside functions. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Lakes Posted September 18, 2006 Share Posted September 18, 2006 I have actually rewritten the whole parsing element of the program. The Lexer is finished but Parsing is hard. Still working out functions and functions inside functions.Plutonium - Scripting language Made with Uranium that was made with Autoit.... 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
i542 Posted September 19, 2006 Share Posted September 19, 2006 Plutonium - Scripting language Made with Uranium that was made with Autoit.... Or maybe this: Mercury - Scripting lanuage made with Plutonium that was made in Uranium which is made in AutoIt and AutoIt was made in C++ (right, isn't?) that was made... Well, nice work, I try to made scripting lang also but I need great example, like this. i542 I can do signature me. Link to comment Share on other sites More sharing options...
RazerM Posted September 19, 2006 Author Share Posted September 19, 2006 This isn't very good. It is parsed using strings etc. I am working on a new version but can't get functions working. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Cw2K1 Posted November 8, 2008 Share Posted November 8, 2008 This isn't very good. It is parsed using strings etc. I am working on a new version but can't get functions working.Error:F:\Documents and Settings\Jess\Desktop\AutoIt Script Files Only\Uranium.au3 (288) : ==> Duplicate function name.:Func _StringBetween($s, $from, $to)why this? Enjoy the complexity.Feel the power of simplicity. Link to comment Share on other sites More sharing options...
Innovative Posted November 9, 2008 Share Posted November 9, 2008 Error:F:\Documents and Settings\Jess\Desktop\AutoIt Script Files Only\Uranium.au3 (288) : ==> Duplicate function name.:Func _StringBetween($s, $from, $to)why this? There's duplicated function in the script o.O Remove one of them .. Link to comment Share on other sites More sharing options...
dbzfanatic Posted November 9, 2008 Share Posted November 9, 2008 There's duplicated function in the script o.O Remove one of them ..Have you tested this? Perhaps when you write a UDF we'll tell you how to do things. I tested this an hour ago and encountered no such error. In fact I got no errors or warnings. The only edit I made was to add #AutoIt3Wrapper_Add_Constants=y to the top, which fixed everything, or at least allowed the script to run without error. You've been warned about posting to boost your count, I'm not a mod or admin but I have no problem reporting. Also I though you said you hated people who "posted like this...O.o" so now you're just being hypocritical. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] 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