You are not logged in.

axtens

Trainee

  • "axtens" is male
  • "axtens" started this thread

Posts: 37

Date of registration: Mar 16th 2009

Location: Perth, WA, Australia

Occupation: Software/Test Engineer

Hobbies: be a husband and a dad, play ukulele, sing

  • Send private message

1

Saturday, October 3rd 2009, 4:38am

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.

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

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Saturday, October 3rd 2009, 11:09am

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.:

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);

klctal

Trainee

  • "klctal" is male

Posts: 70

Date of registration: Jul 13th 2009

Location: Shanghai

Hobbies: Developing software

  • Send private message

3

Saturday, October 3rd 2009, 11:55am

Scripting stuff?
Here:
Function ListFilesPriv(ByVal fld As Scripting.Folder, _
ByVal NestedDirs As Boolean) As String
:D

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

4

Saturday, October 3rd 2009, 1:25pm

here

Yes I know. it comes from:

Microsoft Scripting Runtime
C:\Windows\system32\scrrun.dll

In VB it is a very commonly used ActiveXdll. And in Jabaco most of the functionality is availiable through diverse classes in java#io, java#util...

axtens

Trainee

  • "axtens" is male
  • "axtens" started this thread

Posts: 37

Date of registration: Mar 16th 2009

Location: Perth, WA, Australia

Occupation: Software/Test Engineer

Hobbies: be a husband and a dad, play ukulele, sing

  • Send private message

5

Saturday, October 3rd 2009, 5:53pm

Okay, I think I've figured it out.

If I save the project, there's no ad infinitum.

If I attempt to compile without saving the project, I get the ad infinitum.

YMMV, but that seems to be the situation.

Kind regards,
Bruce.

Hardo

Beginner

Posts: 5

Date of registration: Jan 19th 2010

  • Send private message

6

Tuesday, January 19th 2010, 8:43pm

Hi Bruce,
it's an interesting example for me. Can You show the source of "class Scripting"?
Regards,
Hardo.

Rate this thread
WoltLab Burning Board