ptrex Posted October 24, 2005 Share Posted October 24, 2005 I have noticed that numbers returned from the Random() function, does take in account the International settings of the PC. like if 7.012654699 is returned, it shows a DOT instead of using a COMMA as a decimal seperator. In some countries like ours they use a COMMA as decimal seperator and a DOT as thousand seperator. This might sound trivial but when exporting data Using COM to Excel the figures are not recognized correctly. I took a look in the helpfile but could not find a function to convert it properly. Is this correct ? Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 24, 2005 Share Posted October 24, 2005 I have noticed that numbers returned from the Random() function, does take in account the International settings of the PC.like if 7.012654699 is returned, it shows a DOT instead of using a COMMA as a decimal seperator.In some countries like ours they use a COMMA as decimal seperator and a DOT as thousand seperator.This might sound trivial but when exporting data Using COM to Excel the figures are not recognized correctly.I took a look in the helpfile but could not find a function to convert it properly.Is this correct ?try this 1:$a = random (1, 100) $a = stringreplace ($a, ".", ",")this should work my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
jpm Posted October 24, 2005 Share Posted October 24, 2005 I have noticed that numbers returned from the Random() function, does take in account the International settings of the PC.like if 7.012654699 is returned, it shows a DOT instead of using a COMMA as a decimal seperator.In some countries like ours they use a COMMA as decimal seperator and a DOT as thousand seperator.This might sound trivial but when exporting data Using COM to Excel the figures are not recognized correctly.I took a look in the helpfile but could not find a function to convert it properly.Is this correct ?Random return what is usable by autoit. It is true that Autoit works only with English/American number. So it is not a bug but the decimal point/coma has to be handle by the scripter. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 24, 2005 Share Posted October 24, 2005 (edited) try this 1:$a = random (1, 100) $a = stringreplace ($a, ".", ",")this should work What happens when you have $a = random(1000, 10000) $a could equal 8,473.3844. How do you propose a string replace? I would instead do something like $a = random(1000, 10000) $a = StringReplace($a, ',', '\') $a = StringReplace($a, '.', ',') $a = StringReplace($a, '\', '.') MsgBox(0, '', $a) Edited October 24, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Valik Posted October 24, 2005 Share Posted October 24, 2005 What happens when you have $a = random(1000, 10000) $a could equal 8,473.3844.No it can't. It might equal 8473.3844 but there will not be a comma in there. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 25, 2005 Share Posted October 25, 2005 hehe, nevermind then Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 25, 2005 Share Posted October 25, 2005 i thought that my little thing might be the easiest 1 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
jpm Posted October 25, 2005 Share Posted October 25, 2005 as it is not a bug I move it to Support forum so you can continue the discussion if you need Link to comment Share on other sites More sharing options...
ptrex Posted October 25, 2005 Author Share Posted October 25, 2005 @Nuffilein805 Your solution solved the problem. Thanks Anyhow shouldn't there be any standard functions in AutoIT, to support these kind of conversions. Isn' t is a good idea to have some kind of International support available, since AutoIt is used internationally. Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 25, 2005 Share Posted October 25, 2005 ok i just made a udf for that here it is: $a = random (1, 100) $b = DOT2COMMA($a) msgbox (0, $a, $b) Func DOT2COMMA($number) Select Case StringInStr ($number, ".") $number = StringReplace ($number, ".", ",") Return $number Case StringInStr ($number, ",") $number = StringReplace ($number, ",", ".") Return $number EndSelect EndFunc + a little demo works fine heredot2comma.au3 my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
ptrex Posted October 25, 2005 Author Share Posted October 25, 2005 @Nuffilein805 Perfect !! Maybe you can apply to have this build in as a standart UDF. Thanks again Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 25, 2005 Share Posted October 25, 2005 just posted it in scripts and scraps maybe they include it we'll see, would be fun if they would (yeah my udf in autoit ) enough dreaming of being famous my little chatmy little encryption toolmy little hidermy unsafe clickbot 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