Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Problem converting VB script to Javascript

Henrik

New Coder
Hi

I have made and is using a VB script to check if a folder exist on 3 harddrives.
The VB script is called from a web browser and I have been using Internet Explorer, because it accepts running VB script.
Because Internet Explorer no longer exists in the new Windows 11, I have to find another solution to make the harddrive check.
I think that the best solution is converting the old script to Javascript, but I haven't been abel to make it work.

Can somebody help me with the script converting, and is Javascript the best solution ?

VB script Code:

' Verify that a Folder Exists

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("O:\Økonomi mv\IT-staben\Test") Then
Set objFolder = objFSO.GetFolder("O:\Økonomi mv\IT-staben\Test")
Wscript.Echo "The folder TEST is found on O-drive"
Else
Wscript.Echo "Can't find the folder TEST on O-drive"
End If


Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("P:\Test") Then
Set objFolder = objFSO.GetFolder("P:\Test")
Wscript.Echo "The folder TEST is found on P-drive"
Else
Wscript.Echo "Can't find the folder TEST on P-drive"
End If


Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("Q:\") Then
Set objFolder = objFSO.GetFolder("Q:\")
Wscript.Echo "The folder TEST is found on Q-drive"
Else
Wscript.Echo "Can't find the folder TEST on Q-drive"
End If

-------------------------------------------------------------------------

Hope someone can help :)

Many regards
Henrik Kristensen
 
Hi

I have made and is using a VB script to check if a folder exist on 3 harddrives.
The VB script is called from a web browser and I have been using Internet Explorer, because it accepts running VB script.
Because Internet Explorer no longer exists in the new Windows 11, I have to find another solution to make the harddrive check.
I think that the best solution is converting the old script to Javascript, but I haven't been abel to make it work.

Can somebody help me with the script converting, and is Javascript the best solution ?

VB script Code:

' Verify that a Folder Exists

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("O:\Økonomi mv\IT-staben\Test") Then
Set objFolder = objFSO.GetFolder("O:\Økonomi mv\IT-staben\Test")
Wscript.Echo "The folder TEST is found on O-drive"
Else
Wscript.Echo "Can't find the folder TEST on O-drive"
End If


Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("P:\Test") Then
Set objFolder = objFSO.GetFolder("P:\Test")
Wscript.Echo "The folder TEST is found on P-drive"
Else
Wscript.Echo "Can't find the folder TEST on P-drive"
End If


Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FolderExists("Q:\") Then
Set objFolder = objFSO.GetFolder("Q:\")
Wscript.Echo "The folder TEST is found on Q-drive"
Else
Wscript.Echo "Can't find the folder TEST on Q-drive"
End If

-------------------------------------------------------------------------

Hope someone can help :)

Many regards
Henrik Kristensen
Hi there, I hope you don't mind me asking...what would be the purpose of the script?
 
Hi there, I hope you don't mind me asking...what would be the purpose of the script?

The purpose of the script is from a browser, to check if the O + P + Q network drives are mapped, online and readable :)
That is done by checking if a folder called "Test" is pressent on the 3 network drives in my VB script.


Many regards
Henrik Kristensen
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom