Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , ,

Sponsored Links



My VBScript code not working properly

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-01-2010
- Empty Shell -'s Avatar
Member
 
Join Date: Aug 2006
Posts: 112
My VBScript code not working properly

I'm a complete newbie in VBScript, and there are lot of things that I am unaware of. I am developing an application that runs an HTML file offline. Now I want to transform each line of this text into a variable that Javascript can handle, also I need that HTML file to get the content of a txt file and send that value to a flash file loaded in the same HTML. I have successfully sent a Javascript variable to a flash file. To do the rest I'm trying to use a VBScript code that reads the content of an external text file and send to an HTML 'select' object. But due to some reason, it fails every time I run the HTML outside the desktop directory.
__________________
As you simplify your life, the laws of the universe will be simpler; solitude will not be solitude, poverty will not be poverty, nor weakness.Henry David Thoreau
Reply With Quote
  #2  
Old 19-01-2010
absolute55's Avatar
Member
 
Join Date: Nov 2005
Posts: 1,238
Re: My VBScript code not working properly

I am not able to get your question properly. How are you trying to run an HTML file offline.?? VBScript (VBS) is a Windows scripting language or also known as programming code that can be written as a text file and "executed" like an EXE file. A program such as Internet Explorer or the Windows Script Host carries out the instructions given in script code. Script is run by an interpreter. VBS can be used in several different ways. It originated as a webpage scripting language for Internet Explorer. It will be better if you provide your code.!
Reply With Quote
  #3  
Old 19-01-2010
- Empty Shell -'s Avatar
Member
 
Join Date: Aug 2006
Posts: 112
Re: My VBScript code not working properly

Thanks for sparing your precious time. I am written this code :
Code:
<html>

<script Language="VBScript">

sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")

    Sub Window_OnLoad
        ForReading = 1
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFile = objFSO.OpenTextFile _
            (sCurPath+"\lol.txt", ForReading)
        Do Until objFile.AtEndOfStream
            strLine = objFile.ReadLine
            Set objOption = Document.createElement("OPTION")
            objOption.Text = strLine
            objOption.Value = strLine
            FileContent.Add(objOption)
        Loop
        objFile.Close
    End Sub
</SCRIPT>

<body>
    <select size="5" name="FileContent" style="width:250"></select>
</body>

</html>
I think that there should be something wrong in my code. Please let me know where I went wrong.!! Again Thanks..
__________________
As you simplify your life, the laws of the universe will be simpler; solitude will not be solitude, poverty will not be poverty, nor weakness.Henry David Thoreau
Reply With Quote
  #4  
Old 19-01-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,362
Re: My VBScript code not working properly

You have written the code as
Code:
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
I would like to suggest you to make changes over here. In this line try to replace the period with your C drive, and see if it will run there. Your code should be like this
Code:
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName("C:\")
Then don't put your file on the Desktop, put it in your C drive. Then you can modify your path accordingly.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 19-01-2010
Reegan's Avatar
Member
 
Join Date: Oct 2005
Posts: 2,299
Re: My VBScript code not working properly

Changing your path of your file that you are trying to Run should isolate the problem. You can try to use the code as suggested by the 'opaper'. Maybe changing the path can solve your problem. Since a path is complete and unambiguous if it provides a complete reference from the root of the specified drive. A complete path can only end with a path separator character (\) if it specifies the root folder of a mapped drive. You will also have to keep this in mind. If the problem persists, feel free to post again with proper and detailed information.
Reply With Quote
  #6  
Old 19-01-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
Re: My VBScript code not working properly

I would like to tell you the common uses for VBScript, that include the following :
  • HTAs - create script-powered software that runs in an IE window using DHTML.
  • WMI - Windows Management Instrumentation. WMI functionality can be useful to non-admins. WMI is a script-accessible system used mainly by network administrators to manage multiple PCs on a network.
  • Windows scripting - handle Registry, files, settings, etc.
  • ASP - For webmasters using Windows servers, VBS can be used in ASP pages.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "My VBScript code not working properly"
Thread Thread Starter Forum Replies Last Post
PS 3 redeem code is not working properly for ‘Dead Island Bloodbath Arena‘ Kungfu Pandey Video Games 4 31-12-2011 12:23 PM
Tabpanel code not working properly in real software? singham2011 Software Development 5 30-07-2011 08:12 AM
How to add VBScript code in a page Aahlaadith Software Development 6 30-11-2010 12:38 AM
This device is not present, is not working properly, or does not have all its drivers installed. (code 24) McGrawh Operating Systems 3 02-07-2009 12:10 PM
Error Code 31: DVD drive not working properly Lord Operating Systems 3 03-03-2009 06:14 PM


All times are GMT +5.5. The time now is 04:11 AM.