Asp Error Cannot Use Parentheses When Calling A Sub
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
Cannot Use Parentheses When Calling A Sub Qtp
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs cannot use parentheses when calling a sub msgbox Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just
Cannot Use Parentheses When Calling A Sub Vbscript
like you, helping each other. Join them; it only takes a minute: Sign up Cannot use parentheses when calling a Sub Error 800A0414 VBS up vote 8 down vote favorite I am getting the 800A0414 error in cannot use parentheses when calling a sub vbs lines 7 and 12 of this script: Module Module1 Dim p Sub Main() CreateObject("Wscript.Shell").Run("program.bat", 0, True) p = Process.GetProcessesByName("program") If p.Count > 0 Then WScript.Sleep(300000) Else CreateObject("Wscript.Shell").Run("program clean up.bat", 0, True) End If End Sub Private Function WScript() As Object Throw New NotImplementedException End Function End Module I am trying to run a batch script, that starts a process, then wait until the process terminates, then run another batch script. I also do not want cannot use parentheses when calling a sub replace any command boxes being shown. If their is a easier way please let me know. Thanks for your help vbscript share|improve this question asked Feb 15 '13 at 19:41 Strong 43115 add a comment| 3 Answers 3 active oldest votes up vote 26 down vote accepted When you enclose a procedure's argument list in parentheses, you must use the Call keyword: Call CreateObject("WScript.Shell").Run("program.bat", 0, True) If you omit the Call keyword, you must also drop parentheses: CreateObject("WScript.Shell").Run "program.bat", 0, True share|improve this answer answered Feb 16 '13 at 8:08 Helen 18.3k44173 1 There seems to be an exception that it will let you use parenthesis if you only use the first parameter. ie. CreateObject("Wscript.Shell").Run("program.bat") works without complaint –BeowulfNode42 Dec 8 '15 at 7:55 @BeowulfNode42: .Run("program.bat") is valid syntax - it's interpreted as Call ...Run( ("program.bat") ). Putting parentheses around a specific argument force this argument to be passed ByVal instead of ByRef. In other words, MySub(param) will work if the sub is expecting ByVal arguments, but won't work if it's expecting ByRef arguments. For details, see ByRef and ByVal in VBScript. –Helen Dec 8 '15 at 14:41 add a comment| up vote 3 down vote To complete what's been said before: When Call keyword is used to call a procedure (i.e. sub or function) the arguments must be enclo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow
Vbscript Function Call
the company Business Learn more about hiring developers or posting ads with us Stack Overflow cannot use parentheses when calling a sub classic asp Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7
800a0414
million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ASP “Cannot use parentheses when calling a Sub ” [duplicate] up vote 3 down vote favorite Possible Duplicate: Cannot http://stackoverflow.com/questions/14902134/cannot-use-parentheses-when-calling-a-sub-error-800a0414-vbs use parentheses when calling a Sub As far as I am aware this is correct but i get the error "Cannot use parentheses when calling a Sub" Never used ASP before...can anyone shed light o nthe issue for me? code: <%TESTWeb1.RecentlyViewedDisplay("Recently Viewed Header","Recently Viewed Entry","Recently Viewed Group Entry")%> asp-classic parentheses share|improve this question edited Nov 18 '11 at 14:34 Joel Coehoorn 248k92440661 asked Jun 29 '11 at 12:43 Bob 4526 marked as http://stackoverflow.com/questions/6520807/asp-cannot-use-parentheses-when-calling-a-sub duplicate by Sampson Nov 22 '11 at 0:33 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. Here's an answer to another question that may help: stackoverflow.com/questions/1525668/…. In particular, I found the links informative. –Chris Shaffer Jun 29 '11 at 12:53 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote In VB6 type languages you only need parentheses when calling a function, or when calling a sub using the Call keyword. e.g. DoSoemthing "foo","baa" Call DoSomething("foo","baa") myVar = DoSomething("foo","bar") I think in your case taking the parentheses out of the call should work (although I can't check as I don't have an ASP configured environment handy. share|improve this answer answered Jun 29 '11 at 12:47 Jon Egerton 22.7k85191 Unfortunately just removing them does not work - I get an "Argument not optional" error instead. –Bob Jun 29 '11 at 12:50 2 @Bob, that means you've missed out an argument. Taking the parentheses out is the fix for the error in the OP, looks like that has just opened a new error. –Richard Benson Jun 29 '11 at 12:55 add a comment| Not the answer you're looking for? Browse other questions
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://stackoverflow.com/questions/24242197/cannot-use-parentheses-when-calling-a-sub-vb of this site About Us Learn more about Stack Overflow the company http://www.vbforums.com/showthread.php?307544-*RESOLVED*-VBS-quot-Cannot-use-parentheses-when-calling-a-Sub-quot Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a cannot use minute: Sign up Cannot use parentheses when calling a sub vb up vote -1 down vote favorite First things first, I've had a look on similar issues on the site but can't spot the error of my ways. I'm also new to vb so this too does not help. Please help out a real novice... Thanks dim profileSize dim oFS, oFolder set cannot use parentheses oFS = WScript.CreateObject("Scripting.FileSystemObject") Set wshShell = WScript.CreateObject( "WScript.Shell" ) strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" ) set oFolder = oFS.GetFolder("\\burns\Profiles\" + strUserName + ".V2") ShowFolderDetails oFolder sub ShowFolderDetails(oF) dim F profileSize = of.Size if profileSize > 1006582400 Then WriteFileText(profileSize, strUserName) End If if profileSize > 2516582400 Then WriteFileText(profileSize, strUserName) wscript.echo "Your Windows user profile is too big! Please contact the IT Office" WScript.Quit End if for each F in oF.Subfolders 'ShowFolderDetails(F) next end sub sub WriteFileText(sText, userID) Dim objFSO 'As FileSystemObject Dim objTextFile 'As Object strLogFilePath = "\\burns\Profiles\size_log.txt" strTime = FormatDateTime(Date(), 0) Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile(strLogFilePath, ForAppending, True) ' Write a line. objTextFile.WriteLine (strTime + "," + userID + "," + sText ) objTextFile.Close 'objTextFile.Close End Sub vbscript parentheses share|improve this question edited Jun 16 '14 at 11:04 Holger Just 26k65680 asked Jun 16 '14 at 11:02 user3744538 1 3 What is your question? Where do you have problems? What is the error? What would you expect? What have you tried? Have you read How do I ask good
calling a Sub" If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 3 of 3 Thread: *RESOLVED* VBS:"Cannot use parentheses when calling a Sub" Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Oct 4th, 2004,07:14 PM #1 Disiance View Profile View Forum Posts Visit Homepage Thread Starter Hyperactive Member Join Date Sep 2004 Location Denver, CO Posts 439 *RESOLVED* VBS:"Cannot use parentheses when calling a Sub" I get the error: "Cannot use parentheses when calling a Sub" when I try to call a function in my ASP code that takes two parameters. This works: Code: Function MyTest(para1) End Function MyTest("test") This doesn't: Code: Function MyTest(para1,para2) End Function MyTest1("test1","test2") Disiance Last edited by Disiance; Oct 5th, 2004 at 10:26 AM. Reply With Quote Oct 4th, 2004,08:08 PM #2 Danial View Profile View Forum Posts Big D Join Date Jul 2000 Location ASP.Net Forum Posts 2,877 Re: VBS:"Cannot use parentheses when calling a Sub" Originally posted by Disiance This doesn't: Code: Function MyTest(para1,para2) End Function MyTest1("test1","test2") Disiance Use : Code: Function MyTest(para1,para2) End Function MyTest1 "test1","test2" or Code: Function MyTest(para1,para2) End Function Call MyTest1("test1","test2") [VBF RSS Feed] There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side. If I have been helpful, Please Rate my Post. Thanks. This post was powered by : Reply With Quote Oct 5th, 2004,10:26 AM #3 Disiance View Profile View Forum Posts Visit Homepage Thread Starter Hyperactive Member Join Date Sep 2004 Location Denver, CO Posts 439 Ugg, I feel so stupid, I've been using VBScript/VB for 4 years now, DUH! Thanks, Disiance Reply With Quote Quick Navigation ASP, VB Script Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Visual Basic Visual Basic .NET VB.net CodeBank Visual Basic 6 and Earlier CodeBank - Visual Basic 6 and earlier Modern Windows Experience (Metro) Office Development Mobile Development ASP, VB Script Database Development Reporting API Games and Graphics Programming Game Demos COM and ActiveX Network Programming Visual Basic FAQs Slow Chat with the Microsoft Visual Basic team .NET ASP.NET Visual Basic .NET MVC .Net C# WPF, WCF, WF Silverlight .NET Arch