PureBytes Links
Trading Reference Links
|
This works in my
case.
EnableScript("jscript");
<%
function
GetSubFolderNames(Path,Tag){
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var Folder = FSO.GetFolder(Path);
var FolderEnumerator = new Enumerator(Folder.SubFolders);
var Foldernames = "";
for(;
!FolderEnumerator.atEnd(); FolderEnumerator.moveNext()){
Folder = FolderEnumerator.item();
var Len = Folder.Name.length;
var tagLen = Tag.length;
if(Folder.Name.substring(Len-tagLen,
Len) == Tag){
Foldernames += Folder.name.substring(0, Len-tagLen) + ",";
}
}
return
Foldernames.substring(0, Foldernames.length-1);
}
%>
script = GetScriptObject();
filelist = script.GetSubFolderNames("G:\\Data\\", "");
printf(filelist);
Blair wrote:
--- In amibroker@xxxxxxxxxxxxxxx, Aron <aron.groups@xxx> wrote:
I can run Jscript in Vistax64 with no problems. maybe you need to check
the code.
Aron,
I have the code running in XP (32 bit), but have problems when running it in Vista (64 bit).
Not a JScript programmer, so not sure how else to test. I have done the <Start> <Run...> regsvr32 scrrun.dll <OK> in Vista (64 bit) and it does not give me an error message, but perhaps there is some other way to access the file system object in Vista(64 bit) for the 32 bit application.
I am posting the code again here. Could you test it out?
ANY assistance of pointers GREATLY appreciated.
Here is the JScript code:
<%
function GetSubFolderNames(Path,Tag){
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var Folder = FSO.GetFolder(Path);
var FolderEnumerator = new Enumerator(Folder.SubFolders);
var Foldernames = "";
for(; !FolderEnumerator.atEnd(); FolderEnumerator.moveNext()){
Folder = FolderEnumerator.item();
var Len = Folder.Name.length;
var tagLen = Tag.length;
if(Folder.Name.substring(Len-tagLen, Len) == Tag){
Foldernames += Folder.name.substring(0, Len-tagLen) + ",";
}
}
return Foldernames.substring(0, Foldernames.length-1);
}
%>
Essentially looking for Folders with a specific Tag string on the end of the
folder name, in a specific directory.
Here is the AFL calling code
script = GetScriptObject();
filelist = script.GetSubFolderNames("C:\\Data\\", "data");
TIA
Blair
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|
|