Results 1 to 3 of 3

Thread: How to pass the parameter from ASP to VBS when calling a vbs?

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    PJ, MY
    Posts
    39

    Unhappy How to pass the parameter from ASP to VBS when calling a vbs?

    Hi all,

    How to pass an arguement from ASP page to VB Script?


    Thks in advance,
    AL



    Have you found your paradise yet?

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Um... wanna be more specific??
    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..

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    PJ, MY
    Posts
    39

    Unhappy

    yeah..
    i planning to view Tiff format image on the browser window.

    i have another file called say is imaging.vbs which can lauch a wang imaging application (wangimg.exe) or use it's component to view the tiff. however, i got problem of passing the parameter to the image.vbs in order to let it know which tiff file i would like to open.

    here attached a sample of the code that can load tiff File by using the wang imaging component inside the IE windows.



    '************************************************
    ' File: ImagingIEDemo.vbs (WSH sample in VBScript)
    ' Author: Günter Born
    '
    ' Demonstrates how to use the Imaging ActiveX
    ' control to manipulate image files. Open an image
    ' file, flip the image, show properties, save & print.
    ' Uses Internet Explorer 4.0/5.0 as front end.
    '************************************************
    Option Explicit

    Const title = "Born's Imaging Viewer"

    Const BEST_FIT = 0 ' Fits image to window size
    Const FIT_TO_WIDTH = 1 ' Fits image to window width
    Const FIT_TO_HEIGHT = 2 ' Fits image to window height
    Const INCH_TO_INCH = 3 ' Maintains the relative size

    ' Fileformats
    Const wiFileTypeTIFF = 1 ' Tag Image File Format
    Const wiFileTypeAWD = 2 ' At Work Document (MS Fax)
    Const wiFileTypeBMP = 3 ' Microsoft Bitmap Format
    Const wiFileTypePCX = 4 ' ZSoft PCX
    Const wiFileTypeDCX = 5 ' modfied ZSoft PCX for Fax
    Const wiFileTypeJPG = 6 ' JPEG
    Const wiFileTypeXIF = 7 ' Xerox image documents
    Const wiFileTypeGIF = 8 ' Graphic Interchange Format
    Const wiFileTypeWIFF = 9 ' Wang Image File Format

    Const open = 0 ' Dialog values
    Const saveas = 1

    Const CHECK_READONLY = &H01 ' Read Only check box checked
    Const HIDE_READONLY = &H04 ' Hides the Read-Only check box
    Const SET_CURDIR = &H08 ' set current directory in dialog
    Const HELP_BUTTON = &H10 ' Show Help button in dialog box

    ' define object variable for reference to Internet Explorer
    Dim oIE ' important, variable oIE must be global
    Dim oAdmin ' to admin object
    Dim oEdit ' to edit object
    Dim oScan ' to scan object

    Dim filein, fileout, txt, tmp
    Dim ImgType

    ImgType = Array ("unknown","Tiff", "Awd", "Bmp", _
    "PCX", "DCX", "JPG", "XIF", _
    "GIF", "WIFF")

    ' launch IE and load HTML page with control
    MakeHTMLPage "imaging.htm"

    ' Create an object variable with a reference to HTML elements
    ' and point to the admin object
    Set oAdmin = oIE.Document.All.admin

    ' try to read image file name using Open dialog box
    ' first set the flags
    oAdmin.Flags = CHECK_READONLY + SET_CURDIR + HELP_BUTTON
    oAdmin.DialogTitle = "Born's Open dialog"
    oAdmin.Filter = "All image files|*.tif;*.bmp|" & _
    "TIFF files|*.tif|" & _
    "BMP files|*.bmp|" & _
    "All files|*.*|"
    oAdmin.FilterIndex = 3 ' set bmp filter
    oAdmin.InitDir = GetPath() ' set initial directory
    oAdmin.CancelError = false ' Cancel causes no run-time error

    oAdmin.ShowFileDialog open ' Show Open dialog

    filein = oAdmin.Image ' get selected file name
    If filein = "" then ' Cancel clicked ?
    oIE.Quit ' close Internet Explorer
    WScript.Quit
    End if

    Set oEdit = oIE.Document.All.edit ' get edit object
    oEdit.Image = filein
    oEdit.AutoRefresh = true
    oEdit.Zoom = 100
    oEdit.Display

    If MsgBox ("Show Image properties?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    ' read properties
    txt = "Image properties" & vbCrLf & _
    "File: " & filein & vbCrLf & _
    "Height: " & oAdmin.ImageHeight & vbCrLf & _
    "Width: " & oAdmin.ImageWidth & vbCrLf & _
    "Imagetype: " & ImgType(oAdmin.FileType) & vbCrLf & _
    "Ready"
    MsgBox txt, vbInformation + vbSystemModal, Title
    End If

    If MsgBox ("Show file property page?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    oAdmin.ShowFileProperties filein ' property page
    End If

    If MsgBox ("Flip image?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    oEdit.Flip
    End If

    If MsgBox ("Rotate left?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    oEdit.RotateLeft
    End If

    If MsgBox ("Save Image As?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    oAdmin.DialogTitle = "Born's Save as dialog"
    oAdmin.FilterIndex = 1 ' set tif filter
    oAdmin.InitDir = GetPath() ' set initial directory
    oAdmin.CancelError = false ' Cancel causes no run-time error

    oAdmin.ShowFileDialog saveas ' Show SaveAs dialog

    fileout = oAdmin.Image ' get file name

    If filein = fileout Then
    If oEdit.ImageModified Then _
    If MsgBox ("Overwrite file", _
    vbYesNo + vbSystemModal, Title) = vbYes Then _
    oEdit.SaveAs fileout, oAdmin.FileType
    Else
    ' Note: We can omit the file type, but when the user just
    ' specify the filename without an extension, SaveAs creates
    ' the file without the extension! If no extension is given,
    ' GetFileExt() returns .tif.
    oEdit.SaveAs fileout, GetFileType(GetFileExt(fileout))
    End If
    End If

    If MsgBox ("Save silent?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    ' save as TIFF file
    oEdit.SaveAs GetPath() & "Test.tif", wiFileTypeTIFF
    End If

    If MsgBox ("Print image?" _
    , vbYesNo + vbSystemModal, Title) = vbYes Then
    oEdit.PrintImage
    End If

    MsgBox "Ready", vbSystemModal, Title

    oIE.Quit ' close Internet Explorer
    Set oIE = Nothing ' reset object variable

    WScript.Quit ' Ready

    '### Helper ####
    Sub MakeHTMLPage (file)
    ' Launch Internet Explorer and load a page

    ' *** launch Internet Explorer ***
    Set oIE = WScript.CreateObject("InternetExplorer.Application")
    oIE.top = 10
    oIE.left = 10
    oIE.width = 600
    oIE.height = 520
    oIE.menubar = 0 ' no menu
    oIE.toolbar = 0
    oIE.statusbar = 0
    oIE.navigate GetPath() & file ' Form
    oIE.visible = 1 ' keep visible

    ' Important: wait till MSIE is ready
    Do While (oIE.Busy): Loop
    End Sub

    Function GetFileType (ext)
    ' Retrieve the file type from extension
    Select Case LCase(ext)
    Case ".tif"
    GetFileType = wiFileTypeTIFF
    Case ".tiff"
    GetFileType = wiFileTypeTIFF
    Case ".awd"
    GetFileType = wiFileTypeAWD
    Case ".bmp"
    GetFileType = wiFileTypeBMP
    Case Else ' ### Panic - exit immediately
    MsgBox "Unknown extension " & ext, _
    vbOkOnly + vbError + vbSystemModal, Title
    oIE.Quit ' close IE window
    WScript.Quit 1
    End Select
    End Function

    Function GetFileExt(fname)
    Dim tmp
    ' Retrieve the files extension, set default to .tif
    If InstrRev(fname, ".") = 0 Then
    tmp = ".tif" ' no extension found
    Else ' extract extension
    tmp = Right(fname, Len(fname) + 1 - InstrRev(fname, "."))
    End if
    GetFileExt = tmp
    End Function

    Function GetPath()
    ' Retrieve the script path
    DIM path
    path = WScript.ScriptFullName ' Script name
    GetPath = Left(path, InstrRev(path, "\"))
    End Function
    ' End



    Have you found your paradise yet?

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