saio Posted May 14, 2012 Posted May 14, 2012 I hope that tha is my final stupid question but i just cant find how to calculate sometnig from a variable $text5= Clipget () $text5 = ;What is here? in that case the variable contains something like 5+2 or other numbers and other string +/-/X/..... is thud be simple but I can't get it trouth i made several trys and all of tham failed please help I have another way of doing the operation but it takes too long for the perpes i'm using the script
Mechaflash Posted May 14, 2012 Posted May 14, 2012 Copy this text. Go into SciTE and run $text = ClipGet() msgbox(0,"",$text) it literally copies whatever you have saved to the clipboard. Reveal hidden contents “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”
saio Posted May 14, 2012 Author Posted May 14, 2012 yes that sends 5+2 and it shud send 7 I need it calculated....
Mechaflash Posted May 14, 2012 Posted May 14, 2012 I don't understand what you had a hard time comprehending? Quote Success: Returns a string containing the text on the clipboard. Failure: Sets @error to 1 if clipboard is empty to 2 if contains a non-text entry. to 3 or 4 if cannot access the clipboard. So you test it msgbox(0,"",ClipGet()) The helpfile info seemed pretty cut and dry to me. Reveal hidden contents “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”
Mechaflash Posted May 14, 2012 Posted May 14, 2012 On 5/14/2012 at 1:18 PM, 'saio said: yes that sends 5+2 and it shud send 7 I need it calculated....You're going to have to separate the numbers at the operator. Look at StringSplit(). Then perform the calculation. You'll have to create an algorithm to check for which operator is in use etc. Reveal hidden contents “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”
saio Posted May 14, 2012 Author Posted May 14, 2012 (edited) ok will try am... after the split it shud looklike ??? $text1 what here $text2 what here $text 3 What here $Anser so the calculation shud be than? $text1=5 $tex2 =+ $text3 = 2 if StringInStr ($text,"+") Then Local $number1 = Stringleft ("+") Local $number2 = StringRight ("+") Else if StringInStr ($text,"-") Then Local $number1 =StringLeft ("-") Local $number2 = StringRight ("-") ;same for others "X" eth.... EndIf EndIf ;Get String from the $text??? ;How To calculate the result??? no my skript gives error..... any ideas??? Edited May 14, 2012 by saio
Mechaflash Posted May 14, 2012 Posted May 14, 2012 If its as simple as all additions, it can look like this: $text = ClipGet() $asText = StringSplit($text, "+", 0) $calcText = 0 For $i = 1 to $asText[0] $calcText+=$asText[$i] Next msgbox(0,"",$calcText) Is there a certain pattern to the strings? Such as, is it always addition? Are the values always single digits? Reveal hidden contents “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”
spudw2k Posted May 14, 2012 Posted May 14, 2012 If you are already creating a "calculation string" (i.e. 4+2, 5-3, etc.) Then you should be able to use the "execute" function to evaluate/calculate it. Reveal hidden contents Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Mechaflash Posted May 14, 2012 Posted May 14, 2012 On 5/14/2012 at 2:26 PM, 'spudw2k said: If you are already creating a "calculation string" (i.e. 4+2, 5-3, etc.) Then you should be able to use the "execute" function to evaluate/calculate it.Oh nice. That's exactly what you want. Reveal hidden contents “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”
saio Posted May 14, 2012 Author Posted May 14, 2012 (edited) than it shud be : $text = Execute ($anser) Or i'm wrong again??? That worked 10x $text = ClipGet () $text19 = Execute ($text) msgbox(48, "The anser is :",$text19) Edited May 14, 2012 by saio
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