Results 1 to 11 of 11

Thread: Getting a Setting from the server in ASP VBScript

  1. #1

    Thread Starter
    Addicted Member Frankie902's Avatar
    Join Date
    Feb 2001
    Location
    Lindenwold, NJ, USA
    Posts
    217

    Exclamation

    HELP!
    I am making an ASP document that looks for an INI or a registry setting(on the server) and then changes what it says in the HTML. But Whenever I use VB Code to getsetting for registry, it doesnt work. Declaring the INI things doesnt work either. I am new to ASP and VB Script, so how would I go about doing this? Heres what I am trying to do:

    Code:
    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lsString As Any, ByVal lplFilename As String) As Long
    Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
    Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
    Tester
    Public Sub Tester()
    online = GetSetting("FWN Camline", "Setting", "Online", False) 
    if online = true then 
    response.write "Frankie's Webcam Server is currently ONLINE" 
    else 
    response.write "Frankie's Webcam Server is currently OFFLINE, please stay tuned." 
    end if
    end sub
    or
    Code:
    Tester
    Public Sub Tester()
    online = GetSetting("FWN Camline", "Setting", "Online", False) 
    if online = true then 
    response.write "Frankie's Webcam Server is currently ONLINE" 
    else 
    response.write "Frankie's Webcam Server is currently OFFLINE, please stay tuned." 
    end if
    end sub
    Now they both have GetSetting in which that is for registry, but the first one doenst declare the INI function.
    Using:
    Visual Studio .Net Enterprise
    Visual Basic 6.0 Enterprise

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Cant use API calls in VBScript and there is no built in INI support. Yoo need to look into doing it with the File Scripting Object. I dont have any code for this right now.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Compile the VB into a COM DLL and then call that with your ASP page.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  4. #4

    Thread Starter
    Addicted Member Frankie902's Avatar
    Join Date
    Feb 2001
    Location
    Lindenwold, NJ, USA
    Posts
    217
    Huh? Do I need Professional Edition of VB or somthing? I only have learning edition and I have NO idea what you are talking about.
    Using:
    Visual Studio .Net Enterprise
    Visual Basic 6.0 Enterprise

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You should get at LEAST the professional edition.

    You can't do much with the learning edition. More specifically, you can't do what your trying to do.

    Using a COM object/ActiveX dll is the answer.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6

    Thread Starter
    Addicted Member Frankie902's Avatar
    Join Date
    Feb 2001
    Location
    Lindenwold, NJ, USA
    Posts
    217
    Well I am 13 years old, with no job. Parents dont want to give money away! LEARNING EDITION WAS EXPENSIVE ENOUGH!!!!!!! Somebody make me one of those DLL thingys then if your going to help. I cannot afford Professional Edition!! So mr. rich guy, any other answers?
    Using:
    Visual Studio .Net Enterprise
    Visual Basic 6.0 Enterprise

  7. #7
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    ok frankie, calm down, these people are trying to help you out, not make fun of your finacial status.

  8. #8
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Here is something you can do.

    Search your computer for a file called Registry.vbs

    The code in that file will help you a lot. It is one of the samples which comes with Win98.

  9. #9
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    Also try this link

    Hope that helped.

  10. #10

    Thread Starter
    Addicted Member Frankie902's Avatar
    Join Date
    Feb 2001
    Location
    Lindenwold, NJ, USA
    Posts
    217
    If I put the code into a VBS file the script works. But when I put it in the ASP file it gives me this error:

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /camstat.asp, line 13

    I am using this code(it works in VBS Format, but not in ASP):
    Code:
    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    online = WshShell.RegRead("HKEY_USERS\.DEFAULT\Software\VB and VBA Program Settings\FWN Camline\Setting\Online")
    msgbox online
    if online = "True" then 
    MsgBox "Frankie's Webcam Server is currently ONLINE" 
    else
    Msgbox "Frankie's Webcam Server is currently OFFLINE, please stay tuned." 
    end if

    Any reason Why?

    You can check out whats going on at:
    http://home.fwnsoftware.com/camstat.asp
    Using:
    Visual Studio .Net Enterprise
    Visual Basic 6.0 Enterprise

  11. #11

    Thread Starter
    Addicted Member Frankie902's Avatar
    Join Date
    Feb 2001
    Location
    Lindenwold, NJ, USA
    Posts
    217
    Thank you all very much. The script is up and running at: http://home.fwnsoftware.com/camstat.asp , Even though my netcam doesnt work anymore.
    Using:
    Visual Studio .Net Enterprise
    Visual Basic 6.0 Enterprise

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width