Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jan 2007
    Posts
    160

    Grin Execute vbScript and Use Results as Conditions

    I have a vbScript that runs and will be conditioned to run only on a Win 2K3 Server OS. My question is, how can/should I alter the following script so that I can maybe set AutoPlay properties to be used as conditions for other controls.....

    Dim aWebSvcExtRestrictionList
    Dim extension, sExt, Found

    aWebSvcExtRestrictionList = Array()

    Set IIsWebServiceObj = GetObject("IIS://localhost/W3SVC")

    ' Store original value:
    aWebSvcExtRestrictionList = IIsWebServiceObj.WebSvcExtRestrictionList


    'Troubleshooting...
    ' For each extension record,
    'For Each i in aWebSvcExtRestrictionList
    'MsgBox(i)
    'Next

    Found = 0
    For extension = 0 to UBound(IIsWebServiceObj.WebSvcExtRestrictionList)
    sExt = IISWebServiceObj.Get("WebSvcExtRestrictionList")(e xtension)
    If (0 < (InStr(sExt, "Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.d ll"))) Then
    Found = 1
    If ("0" = Left(sExt, 1)) then
    MsgBox "The ASP.NET v2.0 Web Service Extension needs to be enabled in " & vbCrlf & _
    "Internet Information Services, Web Service Extensions for Adept " & vbCrlf & _
    "Explorer to function properly!", 48, "Enable ASP.NET 2.0..."
    elseif ("1" = Left(sExt, 1)) then
    'Do nothing
    Found = 1
    'MsgBox "ASP.NET v2.0 Extension is enabled!"
    else
    MsgBox "Please check to ensure ASP.NET v2.0 Extension is enabled!"
    end if
    end if
    Next

    If Found = 0 then
    MsgBox "It does not appear that the ASP.NET 2.0 Web Service Extension is present" & vbCrLf & _
    "on this Server. Please add this extension in Internet Information Services," & vbCrLf & _
    "Web Service Extensions by pointing to aspnet_isapi.dll in the following folder:" & vbCrlf & _
    vbCrlf & _
    "<Windows Folder>\Microsoft.Net\Framework\v2.0.50727" & vbCrLf & _
    vbCrlf & _
    "This can also be added via Add/Remove Windows Components. Once installed, " & vbCrLf & _
    "please ensure this extension is enabled!", 48, "ASP.NET 2.0 Web Extension Needed..."
    end if


    If the ASP.NET 2.0 web extension is missing or disabled/prohibited, I would like to add this information to my needed Prerequisites page.

    Any help is greatly appreciated!!

    I would guess I could use File.Open or Shell.Execute actions, but I don't know if there is a way to actually have the script and my AutoPlay wrapper talk to each other - pass information back.


  2. #2
    Join Date
    Jan 2007
    Posts
    160
    Or is there a way to alter my vbscript to cause it to error out if the extension is either not present or prohibited? Then, I could use Application.GetLastError maybe? If I get an error back from the script, I could notify the user on my Prerequisites page that work is needed regarding this extension.

    Am I reaching?

    Usually the replies are pretty quick in this forum. I'm hoping that the lack of early replies doesn't mean this can't be done!

  3. #3
    Join Date
    Jan 2007
    Posts
    160
    I wonder if I can use vbScripts err.raise to send an error under certain conditions. I'll play around with this this afternoon, but if anyone has and ideas, feel free to let me know.....


  4. #4
    Join Date
    Jan 2007
    Posts
    160
    OK, I know when I'm not wanted !

    Bummer, I was hoping there was a way to do this in AutoPlay !

  5. #5
    Join Date
    Jan 2007
    Posts
    160

    Talking

    Here's what I may do. I've altered my vbScript to simply create empty .txt files under certain conditions. I then check for the existence of the files via AutoPlay (File.DoesExist) and can condition my requirements based on that.

    I do have one question...

    I'm using a File.Open to execute the vbScript. I have to investigate this further, but I don't know if I have to wait for this to execute to completion before my files are created for check with File.DoesExist. Is there any way of waiting with the File.Open action. I was toying around with Application.Sleep and I'm currently in what appears to be a working state. I want to comment this out and retest to see if its actually needed.

    My code in this area is basically:

    File.Open(.....
    Application.Sleep(3000);
    if File.DoesExist(.....

    Any info on this part of my issue would be greatly appreciated!!

    THANKS MUCH in advance!!!

  6. #6
    Join Date
    Oct 2006
    Posts
    209

    use file . run

    i think i miss understood so i removed my answer
    Last edited by wasim21k; 05-09-2007 at 07:15 AM.

  7. #7
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    I'm not sure I fully understand - you're trying to pass information between an AMS project and VBS?

    Their probably is a solution out there somewhere; however one way would be to pass the info into a text file or db file. Each AP can share the data.

    If I'm off-base here, just ignore this post.

    HTH

  8. #8
    Join Date
    Jan 2007
    Posts
    160
    Yes, I need to execute a vbScript, in this case, to detect if the ASP.NET Web Service Extension is present and/or enabled. I don't know how to pass back what I found so I initially tried to raise user defined errors in the script then detect these in AP, but that didn't work as the return was always 0.

    The weak thing I figured to do was simply create key condition files (.txt) if certain conditions were met in the script. Then, I could check for the existence of lack thereof in AP as needed.

    It seems to work for me, for now, but I have to test removing the Application.Sleeps to see if the AP script moves to fast for my File.DoesExist actions or if the files will be found if created immediately after the vbScript runs.

  9. #9
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    NitLions
    Instead of the Application.Sleep, you could use a timer event to check the results in the .TXT files every few seconds. Display your results in the AMS AP as the .txt files are created/populated.
    After an inordinate amount of time you can display whatever error messages are needed in the AMS AP.
    It sounds like that may work for you. Maybe someone else in the forum has a better idea.

  10. #10
    Join Date
    Jan 2007
    Posts
    160
    It does seem that the Application.Sleep is needed for my current scheme to work properly. It appears there is a timing issue if not used. For example, if I don't use the .Sleep, my vbScript runs and a ASPDisabled.txt file is created in the user's text folder. The Next button on my Welcome Page fires the script and detects if any files were created. Page.Jump actions will then direct the user properly.

    What seems to have happened in this case is that the File.DoesExist action runs and doesn't find it because it may not have been created by the script at that point. Now, if I run my wrapper again, the file is already there so I am directed to my Prerequisites Page properly.

    I currently have the .Sleep set for 3 seconds. If there is an alternative to using sleep, I'm open to any and all suggestions!!

  11. #11
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    NitLions
    I skimmed over the part where you were jumping pages. The timed event in AMS is page oriented. There is a global timer plugin that is available:

    http://www.indigorose.com/forums/sho...m+timer+plugin

    If that's not an option maybe setting up the timed event on each page so that each page is looking for completion of the VBScript.

    HTH

  12. #12
    Join Date
    Jan 2007
    Posts
    160
    What I have is the script running from the Next button on the welcome page. If one of the conditional files exists, I set a flag which will be used in Page.Jump conditions. For example:

    if Needs = 1 then
    Page.Jump("Prereqs")
    else
    Page.Jump("Install Page")
    end

    Then, in the Prereqs page's OnShow script I run the script and check for the files again to change labels, enable different buttons, show different graphics, etc.. Then further, in the OnTimer script, I run the script and check so that the prereqs page can be refreshed if this particular requirement has been met.

    In typing this, however, I just realized that I really don't need to run the vbScript again in the OnShow script. That may be my solution. I will test simply removing that to see if that gets me over the hump!

  13. #13
    Join Date
    Jan 2007
    Posts
    160
    Removing the script re-run and file.doesexist actions from the OnShow script of my Prereqs page seems to have remedied the timing issue.

    I do have another quick question though. Currently, this is a vbScript. I wonder if there will be any problem in running this through APMS's File.Open action with regards to script blocking. ??

    I guess, worst case, I can create a small.exe to use instead.

    Any input on THIS part of my scenario would be greatly appreciated!


  14. #14
    Join Date
    Jan 2007
    Posts
    160

    Grin

    Also, is there any drawback in using Application.Sleep()? I guess I still need it in my Welcome Page's Next button click script as the timing issue appears again if I remove it for test.

  15. #15
    Join Date
    Jan 2007
    Posts
    160
    OK, hopefully I didn't waste too many people's time, but I've taken the easy way out. I converted the vbScript to a VB app (.exe). This way, I can use the File.Run with the wait parameter. This change will hopefully ease my vbscript blocking fears as well as render the need for Application.Sleep useless.

    THANKS AGAIN FOR ALL THE SUGGESTIONS!!


Page 1 of 2 1 2 LastLast

Posting Permissions

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