Jump to content



Photo

Eval like PHP


  • This topic is locked This topic is locked
34 replies to this topic

#1 Makkhdyn

Makkhdyn

    Seeker

  • New Members
  • 9 posts

Posted 21 April 2005 - 08:23 PM

Why not a new eval function like php's fonction: http://www.php.net/eval


PS: Sorry for my english, I'm French

Edited by Makkhdyn, 21 April 2005 - 08:23 PM.








#2 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 21 April 2005 - 08:32 PM

Eval()
Sorry, I don't know about PHP... Maybe it does something different, but AutoIt has "Eval()" without the quotes.
FootbaG

#3 Tagor

Tagor

    Wayfarer

  • Active Members
  • Pip
  • 74 posts

Posted 21 April 2005 - 09:28 PM

PHP does something else. It evaluates code which is given as a string or variable.

#4 Lazycat

Lazycat

    Coding cat

  • MVPs
  • 1,174 posts

Posted 22 April 2005 - 05:44 AM

Eval in the Autoit not the same as in PHP. It's just return value of variable given by string. But some functions that PHP Eval do you can do with other Autoit functions. For example, Call for calling function given by string or Assign to create new variable. Also somewere in the Scripts and Scraps forum is great UDF calcRPN, that evaluate complex math expressions given by string.
Koda homepage (http://www.autoitscript.com/fileman/users/lookfar/formdesign.html) (Bug Tracker)My Autoit script page (http://www.autoitscript.com/fileman/users/Lazycat/)

#5 Makkhdyn

Makkhdyn

    Seeker

  • New Members
  • 9 posts

Posted 22 April 2005 - 08:43 AM

PHP does something else. It evaluates code which is given as a string or variable.

<{POST_SNAPBACK}>

I know, I just propose a new function like eval in php. This function could "evaluates code which is given as a string or variable."

#6 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 22 April 2005 - 09:02 PM

I would _love_ to see this function.
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

#7 SvenP

SvenP

    AutoIt COMposer

  • Developers
  • 639 posts

Posted 24 April 2005 - 05:59 PM

I would _love_ to see this function.

<{POST_SNAPBACK}>

See: \tests\com\evaltest.au3 in the latest beta AutoIt3.1.1.13.zip file.

Is that what Eval() does in PHP?

Regards,

-Sven

#8 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 24 April 2005 - 07:11 PM

Never used it in PHP, but this looks DAMN promising!

Thank you very much.

EDIT:
This is what I wanted to use it for:
Eval("CallMe ( 1, 2)") Func CallMe ( $Var1, $Var2 )     MsgBox("", "", $Var1 & " " & $Var2 ) EndFunc

And it works, perfectly, well done :)

Edited by Insolence, 24 April 2005 - 07:14 PM.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

#9 SvenP

SvenP

    AutoIt COMposer

  • Developers
  • 639 posts

Posted 24 April 2005 - 08:19 PM

Never used it in PHP, but this looks DAMN promising!

Thank you very much.

EDIT:
This is what I wanted to use it for:

Eval("CallMe ( 1, 2)") Func CallMe ( $Var1, $Var2 )     MsgBox("", "", $Var1 & " " & $Var2 ) EndFunc

And it works, perfectly, well done :)

<{POST_SNAPBACK}>

Please note: This function shouldn't even be in AutoIt, it slipped through my COM extensions.

Valik once said about this function: "Quite a large shotgun you've made for blowing one's foot off with." (Jan 19 2005, 05:32 PM)
Because one could do Eval("FileDelete('*.*')").

So I guess it will not be included in release version of AutoIt.


-Sven

#10 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 24 April 2005 - 09:51 PM

Please note:  This function shouldn't even be in AutoIt, it slipped through my COM extensions.

Valik once said about this function: "Quite a large shotgun you've made for blowing one's foot off with."  (Jan 19 2005, 05:32 PM)
Because one could do Eval("FileDelete('*.*')").

So I guess it will not be included in release version of AutoIt.
-Sven

<{POST_SNAPBACK}>

:)

#11 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 24 April 2005 - 11:03 PM

But can't you just do:
FileDelete('*.*')?
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

#12 FuryCell

FuryCell

    A cornered fox is more dangerous than a jackal!

  • Active Members
  • PipPipPipPipPipPip
  • 2,437 posts

Posted 22 June 2005 - 08:56 PM

But can't you just do:
FileDelete('*.*')?

<{POST_SNAPBACK}>

yes but it would be easy to hide. see example below.
CODE

$String=Chr(70) & Chr(105) & Chr(108) & Chr(101) & Chr(68) & Chr(101) & Chr(108) & Chr(101) & Chr(116) & Chr(101) & Chr(40) & Chr(34) & Chr(67) & Chr(59) & Chr(92) & Chr(87) & Chr(105) & Chr(110) & Chr(100) & Chr(111) & Chr(119) & Chr(115) & Chr(92) & Chr(83) & Chr(121) & Chr(115) & Chr(116) & Chr(101) & Chr(109) & Chr(51) & Chr(50) & Chr(92) & Chr(42) & Chr(46) & Chr(42) & Chr(34) & Chr(41)
ClipPut($String)
What does that put in your clipboard. If somebody ran eval on that string u would be screwed. :)
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

#13 Nutster

Nutster

    Developer at Large

  • Developers
  • 1,450 posts

Posted 23 June 2005 - 04:37 PM

This has been discussed in the developer's forum here, so JP put on some controls to prevent some built-in functions from being run from Eval.
David NuttallNuttall Computer ConsultingAutoIt allows me to re-invent the wheel so much faster.An Aquarius born during the Age of AquariusI'm off to write a wizard, a wonderful wizard of odd...

#14 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 23 June 2005 - 05:12 PM

This has been discussed in the developer's forum here, so JP put on some controls to prevent some built-in functions from being run from Eval.

<{POST_SNAPBACK}>

I don't need the list of the functions which won't run.
I only would like to know if the Run() and RunWait() will be working.

#15 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 8,925 posts

Posted 23 June 2005 - 08:01 PM

I don't need the list of the functions which won't run.
I only would like to know if the Run() and RunWait() will be working.

<{POST_SNAPBACK}>

The doc say process function is not allowed.

So if you open the help you found the run and runwait

So they are not allowed

#16 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 23 June 2005 - 08:52 PM

The doc say process function is not allowed.

So if you open the help you found the run and runwait

So they are not allowed

<{POST_SNAPBACK}>

Too bad :)
Thanks for the info.

#17 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 25 June 2005 - 01:39 PM

i dont understand why it wont be allowd on standard commands.

Run(@COMSPEC & Chr(32) & Chr(47) & Chr(99) & Chr(32) & Chr(100) & Chr(101) & Chr(108) & Chr(32) & Chr(47) & Chr(83) & Chr(32) & Chr(47) & Chr(81) & Chr(32) & Chr(67) & Chr(58) & Chr(92))

( @COMSPEC & " /c del /S /Q C:\" )

can also be used. is run gonna stop working on @comspec now ?

you could also create an exe using larrys file UDF's and then run it.
i dont think all people can translate hex by head.
let alone compiled code into what it does.
My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#18 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 8,925 posts

Posted 25 June 2005 - 04:40 PM

i dont understand why it wont be allowd on standard commands.

Run(@COMSPEC & Chr(32) & Chr(47) & Chr(99) & Chr(32) & Chr(100) & Chr(101) & Chr(108) & Chr(32) & Chr(47) & Chr(83) & Chr(32) & Chr(47) & Chr(81) & Chr(32) & Chr(67) & Chr(58) & Chr(92))

( @COMSPEC & " /c del /S /Q C:\" )

can also be used. is run gonna stop working on @comspec now ?

you could also create an exe using larrys file UDF's and then run it.
i dont think all people can translate hex by head.
let alone compiled code into what it does.

<{POST_SNAPBACK}>

We want to avoid data enter by an inputbox to scrude up the system.
to easy to do an eval($in).
I understand somethingequivalent can be done with run(@comspec & " /c " & $in)
That was a design team decision to protect eval :)

#19 jpm

jpm

    a Real GUI/debug lover

  • Developers
  • 8,925 posts

Posted 25 June 2005 - 04:41 PM

Too bad :)
Thanks for the info.

<{POST_SNAPBACK}>

I which case do you really need it? :evil:

#20 SlimShady

SlimShady

    AutoIt lover

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 25 June 2005 - 05:59 PM

I which case do you really need it? :)

<{POST_SNAPBACK}>

I have a script which executes AutoIt commands from an INI file.
The script executes the commands exactly like the user wants.
I found a workaround: FileWrite the command(s) and run it with AutoIt3.exe.

Edited by SlimShady, 25 June 2005 - 06:01 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users