Compile error infinite loop
When I run the following code (which is just pasted in VB6 code) I get a dialog box
Compile error. Class: 'Module 1' line: 34 Class 'Scripting' not found! [OK]
Meaningful error message, but closing the dialog presents me with another, ad infinitum. The only way out is to kill the Jabaco.exe process.
Did not register the class, BTW.
Regards,
Bruce.
Compile error. Class: 'Module 1' line: 34 Class 'Scripting' not found! [OK]
Meaningful error message, but closing the dialog presents me with another, ad infinitum. The only way out is to kill the Jabaco.exe process.
Did not register the class, BTW.
Regards,
Bruce.
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
Public Sub main(ByJava args() As String) Dim myArgs() As String myArgs = args ' [Your Source] Dim x() As String x = ListFiles("c:\",True) End Sub ' list all the files in a directory ' if NESTEDDIRS = True it lists a whole directory tree ' ' returns a 1-based array containing all the listed files Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _ As String() Dim fso As New Scripting.FileSystemObject Dim fld As Scripting.Folder Dim fileList As String ' get the starting folder Set fld = fso.GetFolder(Path) ' let the private subroutine do all the work fileList = ListFilesPriv(fld, NestedDirs) ' convert to a string array ' (the first element will be a null string) ListFiles = Split(fileList, ";") End Function ' private procedure that returns a file list ' as a comma-delimited list of files Function ListFilesPriv(ByVal fld As Scripting.Folder, _ ByVal NestedDirs As Boolean) As String Dim fil As Scripting.File Dim subfld As Scripting.Folder ' list all the files in this directory For Each fil In fld.Files ListFilesPriv = ListFilesPriv & ";" & fil.Path Next ' if requested, search also subdirectories If NestedDirs Then For Each subfld In fld.SubFolders ListFilesPriv = ListFilesPriv & ListFilesPriv(subfld, NestedDirs) Next End If End Function |
Hi Bruce,
I pasted your code in Jabaco and tried it, but apart from the missing "Scripting"-stuff, I do not get any other error message nor infinite loops.
Could you please upload your project.
OlimilO
P.S.:
Yes, BTW how would you register a class in Jabaco?
There simply is no class named "Scripting" in the Jabaco Framework, but you could help to create one.
Believe me I brood much about the ActiveX-problem. What do you think, how many ActiveXdlls are out there?
hundreds - thousands - one million?
It's not possible to implement all of them into the Jabaco-Framework
If you are a serious programmer from a serious company, who makes money with software, and you have a special very important ActiveXdll, you could use third party software with Jabaco, to be able to work with your special ActiveXdll.
e.g. like ComfiJ from TeamDev
for such a simple problem like listing files, just dig the internet for a equivalent Java solution and translate the code to Jabaco, we could help you to do this.
http://www.exampledepot.com/egs/java.io/GetFiles.html
I pasted your code in Jabaco and tried it, but apart from the missing "Scripting"-stuff, I do not get any other error message nor infinite loops.
Could you please upload your project.
OlimilO
P.S.:
Quoted
Did not register the class, BTW.
Yes, BTW how would you register a class in Jabaco?
There simply is no class named "Scripting" in the Jabaco Framework, but you could help to create one.
Believe me I brood much about the ActiveX-problem. What do you think, how many ActiveXdlls are out there?
hundreds - thousands - one million?
It's not possible to implement all of them into the Jabaco-Framework
If you are a serious programmer from a serious company, who makes money with software, and you have a special very important ActiveXdll, you could use third party software with Jabaco, to be able to work with your special ActiveXdll.
e.g. like ComfiJ from TeamDev
for such a simple problem like listing files, just dig the internet for a equivalent Java solution and translate the code to Jabaco, we could help you to do this.
http://www.exampledepot.com/egs/java.io/GetFiles.html
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
File dir = new File("directoryName");
String[] children = dir.list();
if (children == null) {
// Either dir does not exist or is not a directory
} else {
for (int i=0; i<children.length; i++) {
// Get filename of file or directory
String filename = children[i];
}
}
// It is also possible to filter the list of returned files.
// This example does not return any files that start with `.'.
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return !name.startsWith(".");
}
};
children = dir.list(filter);
// The list of files can also be retrieved as File objects
File[] files = dir.listFiles();
// This filter only returns directories
FileFilter fileFilter = new FileFilter() {
public boolean accept(File file) {
return file.isDirectory();
}
};
files = dir.listFiles(fileFilter);
|
Similar threads
-
Tips, Tricks, Samples & Tutorials »-
Access to Excel from Jabaco via JExcel
(Feb 3rd 2009, 4:49pm)
-
Tips, Tricks, Samples & Tutorials »-
Communicating between forms and with the internet in Jabaco
(Apr 2nd 2009, 8:15am)
-
General topics, questions and discussions »-
compile jabaco source file to class file
(Mar 27th 2009, 9:44am)
-
General topics, questions and discussions »-
Where can I get documentation about Jabaco language?
(Jan 12th 2009, 6:51pm)
-
General topics, questions and discussions »-
File operations don't work for me
(Dec 14th 2008, 7:32pm)
