smellyfingers Posted May 4, 2013 Posted May 4, 2013 Hi all, im trying to understand what is going on in this script, im getting a value from a webpage like 8,5378 and when multiplying with any other value it ignores the decimal, so if i input 10 the output becomes 80 when it should be 85,378, any idea? #include <IE.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> Global $oIE Global $kr Global $eur Global $prop Global $summa Global $frame Global $newinfo Global $varde Global $swe = InputBox("SEK - EUR","Skriv in EUR du vill omvadla till SEK") $oIE = _IECreate("http://www.nordea.se/F%c3%b6retag/Utland/Valutahantering/Daglig%2bmittkurs/1528952.html",0,0) _IELoadWait($oIE) Sleep(1000) $frame = _IEBodyReadText($oIE) ;MsgBox(262144,"info1",$frame) ;Sleep(2000) $prop = _StringBetween($frame," Euroområdet EUR Euro "," ") ;_ArrayDisplay($prop, 'Default Search') $varde = $prop[0] ;StringReplace($varde,".",",",3) MsgBox(262144,"info1",$varde) ;MsgBox(262144,"info2",$varde) _IELoadWait($oIE) _IEQuit($oIE) $eur = Int($varde, 9) $kr = Int($swe, 9) $summa = Int($eur*$kr, 9) MsgBox(262144,"EUR - SEK","SEK värde i EUR per " & " " & $swe & " KR " & "är" & " " & $summa)
FireFox Posted May 4, 2013 Posted May 4, 2013 (edited) Hi, The comma is not recognized as a decimal, so you need to replace it with a point. ConsoleWrite(Number("8,5378") & @CrLf) ConsoleWrite(Number("8.5378") & @CrLf) Br, FireFox. Edited May 4, 2013 by FireFox
smellyfingers Posted May 4, 2013 Author Posted May 4, 2013 #include <IE.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> Global $oIE Global $kr Global $eur Global $prop Global $summa Global $slutsumma Global $frame Global $varde Global $swe = InputBox("SEK - EUR","Skriv in EUR du vill omvadla till SEK") $oIE = _IECreate("http://www.nordea.se/F%c3%b6retag/Utland/Valutahantering/Daglig%2bmittkurs/1528952.html",0,0) _IELoadWait($oIE) Sleep(1000) $frame = _IEBodyReadText($oIE) ;MsgBox(262144,"info1",$frame) ;Sleep(2000) $prop = _StringBetween($frame," Euroområdet EUR Euro "," ") ;_ArrayDisplay($prop, 'Default Search') $varde = $prop[0] $eur = StringReplace($varde,",",".",1) $kr = StringReplace($swe,",",".",1) MsgBox(262144,"info1",$eur & " " & $swe) _IELoadWait($oIE) _IEQuit($oIE) $summa = $eur*$kr $slutsumma = StringReplace($summa,",",".",1) MsgBox(262144,"EUR - SEK","SEK värde i EUR per " & " " & $swe & " KR " & "är" & " " & $slutsumma) Thanx Firefox! i forgot to actually save the stringreplace into a variable in the first place too and i noticed i tried replacing the wrong thing aswell. "blaming the headache"
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