Trong Posted February 23, 2015 Posted February 23, 2015 Au3 file:Local $VarToNumber = "123456789" Local $VarToNameNeedGet= "987654321" Dim $OtherVar=ReNumber($VarToNumber) Dim $VarOther=ReNumber($VarToNameNeedGet) ConsoleWrite($OtherVar & @CRLF) ConsoleWrite(ReNumber($VarToNameNeedGet) & @CRLF) Func ReNumber($sVarToNumber) Return Number($sVarToNumber) EndFuncFind all:ReNumber($VarToNumber) ReNumber($VarToNameNeedGet)Copy Calculator function into the current script! (before):Func ReNumber($sVarToNumber) Return Number($sVarToNumber) EndFunc Replace:ReNumber($VarToNumber) -> 123456789ReNumber($VarToNameNeedGet) -> 987654321Results:Local $VarToNumber = "123456789" Local $VarToNameNeedGet= "987654321" Dim $OtherVar="123456789" Dim $VarOther="987654321" ConsoleWrite($OtherVar & @CRLF) ConsoleWrite("987654321" & @CRLF) Func ReNumber($sVarToNumber) Return Number($sVarToNumber) EndFunc Regards,
orbs Posted February 23, 2015 Posted February 23, 2015 that is correct. what is your question? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Trong Posted February 23, 2015 Author Posted February 23, 2015 that is correct. what is your question? Get name of Variable when it access Functions! Local $ThistText = "ValueOfVar" ConsoleWrite(respond($ThistText) & @CRLF) Func respond($sVar) Return "$sVar" EndFunc ; Need it =>> $ThistText Regards,
johnmcloud Posted February 23, 2015 Posted February 23, 2015 Local $ThisText = "ValueOfVar" ConsoleWrite(_GetVarName("$ThisText") & @CR) Func _GetVarName($sVar) Return $sVar & ' = "' & Eval(StringTrimLeft($sVar, 1)) & '"' EndFunc ;==>_GetVarName
Trong Posted February 23, 2015 Author Posted February 23, 2015 (edited) Local $ThisText = "ValueOfVar" ConsoleWrite(_GetVarName("$ThisText") & @CR) Func _GetVarName($sVar) Return $sVar & ' = "' & Eval(StringTrimLeft($sVar, 1)) & '"' EndFunc ;==>_GetVarNameNot something I need!_GetVarName($ThisText) Edited February 23, 2015 by Trong Regards,
johnmcloud Posted February 23, 2015 Posted February 23, 2015 (edited) If you pass the variable to the argument of the function, you get the contents of the variable. For the name you need to pass has string. Don't quote if is unecessary. Edited February 23, 2015 by johnmcloud
Trong Posted February 23, 2015 Author Posted February 23, 2015 If you pass the variable to the argument of the function, you get the contents of the variable. For the name you need to pass has string. Don't quote if is unecessary. I need name of variable, not contents of variable. _GetVarName($(Random(111111111,999999999999))) Regards,
johnmcloud Posted February 23, 2015 Posted February 23, 2015 (edited) I have understand but i think you don't have understand what i'm say at my previus post...anyway there is any REAL reason why you need the name of the variable? Edited February 23, 2015 by johnmcloud
Trong Posted February 23, 2015 Author Posted February 23, 2015 I have understand but i think you don't have understand what i'm say at my previus post...anyway there is any REAL reason why you need the name of the variable?#1a file like this:Local $VarToNumber = "123456789" Local $VarToNameNeedGet= "987654321" Dim $OtherVar=ReNumber($VarToNumber) Dim $VarOther=ReNumber($VarToNameNeedGet) ConsoleWrite($OtherVar & @CRLF) ConsoleWrite(ReNumber($VarToNameNeedGet) & @CRLF) Func ReNumber($sVarToNumber) Return Number($sVarToNumber) EndFuncNeed to calculate and replace all the variables! Regards,
kylomas Posted February 23, 2015 Posted February 23, 2015 Trong, Need to calculate and replace all the variables! We are having trouble understanding what you want to do. A variable local to a function has no relation to anything outside the function, in fact, only exists within the function. As far as I know there is no way for a function to know what variable was used as a parameter unless you tell it, like johnmcloud did... Local $VarToNumber = "123456789" Local $VarToNameNeedGet= "987654321" Dim $OtherVar=ReNumber($VarToNumber) Dim $VarOther=ReNumber($VarToNameNeedGet) ConsoleWrite($OtherVar & @CRLF) ConsoleWrite(ReNumber($VarToNameNeedGet) & @CRLF) Func ReNumber($x) Return Number($x) EndFunc It might help if you defined what you are trying to do and use a translator. Trong 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Solution orbs Posted February 23, 2015 Solution Posted February 23, 2015 Trong, AutoIt does not have the function you are looking for. better explain what is your purpose, so we can help you find the way to accomplish it. Trong 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
Trong Posted February 23, 2015 Author Posted February 23, 2015 My translater cant describe my wish.Thanks for your help! Regards,
kylomas Posted February 23, 2015 Posted February 23, 2015 What is your native language? Maybe one of the other members can help. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Trong Posted February 23, 2015 Author Posted February 23, 2015 (edited) What is your native language? Maybe one of the other members can help.VietnameseDịch thuật viên của tôi không hiểu điều tôi muốn nói, nó không phải chuyên ngành của cô ấy.Tôi muốn lấy tên của Biến vào khi truy xuất vào Hàm. Không phải nội dung của Biến. Edited February 23, 2015 by Trong Regards,
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