Nakuribon Posted December 20, 2005 Posted December 20, 2005 (edited) this plugin allows you to use the scripting language Ruby inside AutoIt. The two functions are RubyEval and RubyPrivateEval. In the non-private function, all variables can be accessed between function calls, while variables definded in a private function can only be accesed within the same function. I know that doesn't make much sense, so here's an example:RubyPrivateEval("a='hello'")$ret = RubyEval("a") ;throws an "a isn't defined" error and sets @error to 1Yes, its true, when there is an error in your syntax, it returns the error number and a description instead of the evaluation, and sets @error to 1. The only argument they take are a string containing Ruby code. To insert multi-line bits of code, either make a string with @crlfs where you want newlines (hard way) or just seperate the lines with a semicolon ( (easy way).enjoy folks!ruby.au3ruby.dll Edited December 20, 2005 by Nakuribon i own this sig... php rulezlinks:My PSP Web Portal
Helge Posted December 20, 2005 Posted December 20, 2005 (edited) First word that came to my head when reading this : inbreeding This is the weirdest plugin ever...a script language in another.I haven't tried Ruby, so maybe this is more useful than I think..Edit : missing char. Edited December 20, 2005 by Helge
Nakuribon Posted December 20, 2005 Author Posted December 20, 2005 (edited) there is a lot Ruby can do that autoit can't, and vice versa. For instance, Ruby has a mysql api, and all thats needed is the line "require 'mysql'" and then you call mysql functions within ruby, and now within autoit. no more of that odedb crap lol. Programs that use these languages together effectively will be incredible. edit: i just remembered the mysql ruby extension for windows is very rare. here it is for those that want it. edit 2: i also forgot to mention, as of right now, these functnios always return a string representation of the result. I dont think it can return some of its objects yet, but that will come in time. I just need to figure out how to get AutoIt plugins to return a result that isnt dependent on type....mysql.zip Edited December 20, 2005 by Nakuribon i own this sig... php rulezlinks:My PSP Web Portal
piccaso Posted December 20, 2005 Posted December 20, 2005 nice one there is a file missing: 'msvcrt-ruby18.dll'at least my pc demandet it...found inside ruby-1.8.3-i386-mswin32.zip in '/bin' dir.are you interested in doing something like that with php?i know it's possible, there is a dll for windows web servers that evaluates php code.but i have only very (very!!) basic c/c++ knowledge (i'll try finding it if you are...) CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Nakuribon Posted December 20, 2005 Author Posted December 20, 2005 (edited) i have an apache extension that lets me use ruby scripts as web pages, ill find the link if u want edit: woops yea i thought it might need that dll i couldnt tell on my own because it wouldnt let me move it lol yea just put that dll in the same dir as the plugin dll and u should b fine Edited December 20, 2005 by Nakuribon i own this sig... php rulezlinks:My PSP Web Portal
Michel Claveau Posted December 20, 2005 Posted December 20, 2005 Hi! piccaso said: nice one there is a file missing: 'msvcrt-ruby18.dll'You can install rubyscript : http://arton.hp.infoseek.co.jp/index.htmlI know play, from AutoIt : - VBScript - JScript - PerlScript - Python - RubyScript - PHPscript - HaskellScriptAnd I search for LuaScript. But I don't can find LuaScript-download. An idea ?
enaiman Posted October 21, 2009 Posted October 21, 2009 I know I might ressurect a dead-old thread (no posts for the last 4 years). I was searching today to see if there is a way that ruby code can be excecuted from within a *.au3 script. However - I couldn't figure how to get this working. if I use the example provided here: $handle = PluginOpen("ruby.dll") $retval = RubyPrivateEval("a='hello world';a") msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) $retval = RubyEval("a") msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) RubyEval("a=2") $retval = RubyEval("a") msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) PluginClose($handle) I get an error about functions being "undefined" Since I didn't find any refference to PluginOpen() or PluginClose() in the help file, I presumed that these commands were replaced with something else. I've modified the code: $handle = DllOpen("ruby.dll") $retval =DllCall($handle, "str", "RubyPrivateEval", "str", "a='hello world';a") msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) DllClose($handle) I don't get the error about "undefined" functions anymore but the script exits with an error "-1073741819" Can anyone please help me understand what's happening? Thank you. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
JRowe Posted October 21, 2009 Posted October 21, 2009 These are plugins. I assume you're getting the errors running from scite, so you have to add the following atop your script for scite to work properly.#AutoIt3Wrapper_Plugin_Funcs= someFuncName1, someFuncName2, ... someFuncNameNPlugins are handy little beasts. [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]
Michel Claveau Posted October 21, 2009 Posted October 21, 2009 (edited) Hi! The (implicite) print in your Ruby's code will have some problems. Other solution (see my prior message, in this thread), is RubyScript. An example with Autoit: $code="" $code=$code & @CRLF & "def tst(a,b)" $code=$code & @CRLF & " c=a+b" $code=$code & @CRLF & " return c" $code=$code & @CRLF & "end" $code=$code & @CRLF & "tst(111,222)" MsgBox(0,"Code RubyScript :",$code) $as = ObjCreate("ScriptControl") $as.language="RubyScript" $retour = $as.eval($code) MsgBox(0,"Valeur de retour : ",$retour) Edited October 21, 2009 by Michel Claveau
enaiman Posted October 22, 2009 Posted October 22, 2009 (edited) @JRowe @Michel ClaveauThank you very much to both of you.I have the way to continue my work now EDIT:@JRowe - that worked wonderfully @Michel ClaveauVery nice approach. Unfortunately it didn't work - somehow it gave an error about $as.language="RubyScript", guess it didn't like "RubyScript".Because this is not a support thread and I presume not many people are interrested in Ruby - may I have your permission to PM you some questions about a ruby script? (about how to include "require" statements ...) Edited October 22, 2009 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Zedna Posted October 22, 2009 Posted October 22, 2009 On 10/21/2009 at 2:51 AM, 'enaiman said: Since I didn't find any refference to PluginOpen() or PluginClose() in the help file, I presumed that these commands were replaced with something else.Look herehttp://www.autoitscript.com/autoit3/files/beta/autoit/undocumented/ Resources UDF ResourcesEx UDF AutoIt Forum Search
Michel Claveau Posted October 23, 2009 Posted October 23, 2009 (edited) Re ! On 10/22/2009 at 10:14 PM, 'enaiman said: Very nice approach. Unfortunately it didn't work - somehow it gave an error about $as.language="RubyScript", guess it didn't like "RubyScript". Because this is not a support thread and I presume not many people are interrested in Ruby - may I have your permission to PM you some questions about a ruby script? (about how to include "require" statements ...) The ActiveScripting technology is not restricted to Ruby. I use it often. Very much JSCRIPT & VBSCRIPT, and very Python(Script). Very (very) few Ruby & Perl. But no directly from Autoit (rather from HTA & Python). From Autoit, I use very very very much Python, via the COM way. With a software named PONX (http://ponx.org ; warning, huge installation). And Ponx give me (contain) ActiveScripting. With the combination of Ponx + ActiveScripting + RubyScript, functions written in Ruby (or Python) can become functions of Autoit. Your problem is not easy to solve, because I no have the problem, on my installations (more than 200 computers of my customers). But, my method to configure Windows is perhaps the key... You can try to send me direct mails. But my antiSpam is hard (it delete 1500 mails by day). Therefore, give your e-mail of sender, if you want be included in the white-list ...or prefix yours message's subjects with: [AUTOIT] @-salutations, and sorry for my bad english. Edited October 23, 2009 by Michel Claveau
Tin2tin Posted October 23, 2009 Posted October 23, 2009 @ Michel ClaveauCan you get Avisynth to work that way too? DVD slideshow GUI
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