doesn't like my parentheses

Results 1 to 4 of 4

Thread: doesn't like my parentheses

  1. #1
    Chris M Guest

    Default doesn't like my parentheses

    I wrote the following script to move a file from one place to another. But when I run the page, I get the error message that is listed below under the script. I&#039;ve tried removing the parentheses, which gives me a different error message (Object expected), and I&#039;ve tried removing the quotations, which also doesn&#039;t help. Does anyone know what&#039;s wrong? Thanks.<BR><BR>&#060;%<BR>Dim strPathInfo, strPhysPath<BR>strPathInfo = Request.ServerVariables("SCRIPT_NAME")<BR>strPhysP ath = Server.MapPath(strPathInfo)<BR>Dim objFSO, objFolder, objFolderContents, objFileItem, objFile<BR>set objFSO = CreateObject("Scripting.FileSystemObject")<BR>objF ile = objFSO.GetFile(strPhysPath)<BR>objFile.Copy ("C:Inetpubwwwroot
    afi\",true)<BR>Response.Write "<BR>It is done."<BR>%&#062;<BR><BR>Error Type:<BR>Microsoft VBScript compilation (0x800A0414)<BR>Cannot use parentheses when calling a Sub<BR>/tests/filemanip.asp, line 35, column 46<BR>objFile.Copy ("C:Inetpubwwwroot
    afi\",true)<BR>---------------------------------------------^<BR>Browser Type:<BR>Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) <BR>Page:<BR>GET /tests/filemanip.asp <BR>Time:<BR>Sunday, May 20, 2001, 5:00:41 PM

  2. #2
    Join Date
    Dec 1969

    Default RE: doesn't like my parentheses

    Is the folder name is correct

  3. #3 Guest

    Default RE: doesn't like my parentheses

    I presume the line causing the error is this one:<BR><BR>objFile.Copy ("C:Inetpubwwwroot
    afi\",true)<BR><BR>Just remove the brackets<BR><BR>objFile.Copy "C:Inetpubwwwroot
    afi\",true<BR><BR>Subroutines are actions, and functions are subcode that returns a value. Subroutines are usually of the form:<BR><BR>MySub Param1, Param2<BR>or <BR>Obj.MySub Param1, Param2<BR><BR>The parameter list is not enclosed in brackets.<BR><BR>Functions are usually of the form:<BR><BR>MyVar = MyFunc(Param1, Param2)<BR>or<BR>MyVar = Obj.MyFunc(Param1, Param2)<BR><BR>Parameters are enclosed in brackets.<BR><BR>Of course there can be any number of parameters in either case. I you still do not understand the difference between subroutines and functions, you need to find a book on programming basics.

  4. #4
    Reggie Guest

    Default Provide a destination filename.

    Instead of:<BR>objFile.Copy ("C:Inetpubwwwroot
    afi\",true)<BR><BR>You need:<BR><BR>objFile.Copy ("C:Inetpubwwwroot

Posting Permissions

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