Jump to content

Displaying A Variable


Recommended Posts

But Val, isn't that pointless? You're overwriting what's in the variable with the variable name (wow that's a dumb idea) so you can display the variable... if you're going to do that why even have a variable? Why not just use a string?

I totally agree green.... it was "Pointless"

( so is the whole thread to me )

8)

NEWHeader1.png

Link to comment
Share on other sites

Couldn't you just define your variable with another variable?

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

And yet we're still posting stupid ideas, while he's offline. Won't he be happy when he gets back to this thread.

nopper... he sure won't

he didn't reply to our first posts... ( as if they worked )

he probably wont even look here now

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Here is a simple way to get the variable name. Needs to be uncompiled.

Global $test

$result = _GetVarName($test, @ScriptLineNumber)
MsgBox(0, '', $result)

Func _GetVarName($var, $linenumber)
    If Not @Compiled Then
        $line = FileReadLine(@ScriptFullPath, $linenumber)
        $regex = StringRegExpReplace($line, '.*(_GetVarName.)', '')
        $regex = StringRegExpReplace($regex, ', @ScriptLineNumber.*', '')
        Return $regex
    EndIf
EndFunc

though, to make use of it, then you are preseting the function call literally.

Edited by MHz
Link to comment
Share on other sites

Here is a simple way to get the variable name. Needs to be uncompiled.

Global $test

$result = _GetVarName($test, @ScriptLineNumber)
MsgBox(0, '', $result)

Func _GetVarName($var, $linenumber)
    If Not @Compiled Then
        $line = FileReadLine(@ScriptFullPath, $linenumber)
        $regex = StringRegExpReplace($line, '.*(_GetVarName.)', '')
        $regex = StringRegExpReplace($regex, ', @ScriptLineNumber.*', '')
        Return $regex
    EndIf
EndFunc

though, to make use of it, then you are preseting the function call literally.

But if you call it twice on one line it gets the second one twice, which is why I used vars to mark how many times it has been called per line. Edited by gamerman2360
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...