PureBytes Links
Trading Reference Links
|
Hi,
I don't have AmiBroker on this computer. So, I can't test this out.
But, see if the following article will do what you need. It is doing
an alphabetical sort of the entire line, which means that the sort
will effectively be on the first column.
The easiest approach would probably be to just embed the script
directly into your AFL wrapped in scripting tags as follows:
EnableScript("vbscript");
... // Usual AFL code
<%
// script found at
http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb05/he
y0225.mspx
%>
... // Usual AFL code
Or, for code reuse, you could create a function in a separate AFL
file and #include it wherever needed. If neither of those work out,
you could instead have the vbscript stored in a .vbs file and choose
to run it from AFL by calling out to wscript.
Just in case you have trouble accessing the link provided, here is
the actual script. Change the hard coded data file path
(C:\Scripts\Computers.txt) to wherever your data file will be. If you
want to parameterize it to specify where the data file is or which
column to sort on, that should be do-able with some additional work.
The behavior of the script is explained on the webpage at the link
provided.
Mike
Const adVarChar = 200
Const MaxCharacters = 255
Const ForReading = 1
Const ForWriting = 2
Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "ComputerName", adVarChar, MaxCharacters
DataList.Open
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computers.txt",
ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
DataList.AddNew
DataList("ComputerName") = strLine
DataList.Update
Loop
objFile.Close
DataList.Sort = "ComputerName"
DataList.MoveFirst
Do Until DataList.EOF
strText = strText & DataList.Fields.Item("ComputerName") & vbCrLf
DataList.MoveNext
Loop
Set objFile = objFSO.OpenTextFile("C:\Scripts\Computers.txt",
ForWriting)
objFile.WriteLine strText
objFile.Close
------------------------------------
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|