IAMK Posted October 17, 2017 Share Posted October 17, 2017 Hello, I am trying to use a string variable like a hash definition. From what I read, hash definitions cannot be used for this, and I am unable to do it with strings. Example of what I want: $stuff1 = "Words", 0, 0 ;Literally this. $stuff2 = """Words"", 0, 0" ;This outputs the string exactly as it is seen in $stuff1 ToolTip($stuff2) ;I want this to run ToolTip("Words", 0, 0) How can I achieve this result? Thank you in advance. Link to comment Share on other sites More sharing options...
iamtheky Posted October 17, 2017 Share Posted October 17, 2017 $stuff2 = """Words"", 0, 0" ;This outputs the string exactly as it is seen in $stuff1 Tooltip( execute($stuff2) ) ;I want this to run ToolTip("Words", 0, 0) sleep (10000) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
IAMK Posted October 17, 2017 Author Share Posted October 17, 2017 @iamtheky Thank you, that worked. However, it is following my mouse. It should be at 0, 0. Link to comment Share on other sites More sharing options...
IAMK Posted October 17, 2017 Author Share Posted October 17, 2017 @iamtheky ToolTip(execute($stuff2), 0, 0) ;This puts it at 0, 0, but if I want the position to be defined in the string, how would I do that? Link to comment Share on other sites More sharing options...
iamtheky Posted October 17, 2017 Share Posted October 17, 2017 because im retarded, i totally meant to use eval and that would have resulted in at best similar results, at worst all of those items in the first parameter. going to probably have to split that into the multiple parameters rather than passing a string that is interpreted as three distinct parameters $Stuff2 = 'Words, 0, 0' ;This outputs the string exactly as it is seen in $stuff1 Tooltip( stringsplit($stuff2 , "," , 2)[0] , stringsplit($stuff2, "," , 2)[1] , stringsplit($stuff2, "," , 2)[2] ) ;I want this to run ToolTip("Words", 0, 0) sleep (10000) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
IAMK Posted October 17, 2017 Author Share Posted October 17, 2017 @iamtheky That's messier than I would have liked, but it works. Thank you for your quick response. Link to comment Share on other sites More sharing options...
iamtheky Posted October 17, 2017 Share Posted October 17, 2017 If you could store it as an array rather than a string you wouldnt need the split. Because ultimately in this effort you are passing a string, to a function which accepts a string as its first parameter, how else would you expect it to know you want this particular string split if the only commas you can pass will be within the string you are passing? ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
kylomas Posted October 17, 2017 Share Posted October 17, 2017 IAMK, You could use a wrapper function like so... Local $parm1 = 'words', $parm2 = 100, $parm3 = 0 _myToolTip($parm1, $parm2, $parm3) Func _myToolTip($p1, $p2, $p3) ToolTip($p1, $p2, $p3) Sleep(2000) EndFunc ;==>_myToolTip kylomas 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 Link to comment Share on other sites More sharing options...
IAMK Posted October 17, 2017 Author Share Posted October 17, 2017 @kylomas Yes, that is what I have done. Thank you for the response. Link to comment Share on other sites More sharing options...
Danyfirex Posted October 17, 2017 Share Posted October 17, 2017 Hello Just for fun... Local $stuff1 = '"Words", 0, 0' Local $stuff2 = '"Words", 300, 300' Local $stuff3 = '"Words", 300, 300, "SomeTitle" ,1,1' _ToolTip($stuff1) Sleep(3000) _ToolTip($stuff2) Sleep(3000) _ToolTip($stuff3) Sleep(3000) Func _ToolTip($sParam) Local $aParam[] = ["", Default, Default, "", 0, Default] Local $aSplit = StringSplit($sParam, ",") For $i = 1 To $aSplit[0] $aParam[$i - 1] = $aSplit[$i] Next ToolTip($aParam[0], $aParam[1], $aParam[2], $aParam[3], $aParam[4], $aParam[5]) EndFunc ;==>_ToolTip Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Tekk Posted October 17, 2017 Share Posted October 17, 2017 $stuff2 = 'Words, 0, 0' _Call(ToolTip, $stuff2) Sleep(2000) Func _Call($fuFunc, $sArgs) Return Call($fuFunc, StringSplit("CallArgArray," & $sArgs, ",", 2)) EndFunc Link to comment Share on other sites More sharing options...
Atoxis Posted October 17, 2017 Share Posted October 17, 2017 Howdy, I just made a post about a problem i'm having and I think this might help me a tad. 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