Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Const Question

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,46780
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Const Question
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Const Question - 5/8/2007 4:24:32 AM   
  netman06

 

Posts: 108
Score: 0
Joined: 10/19/2006
Status: offline
Hello,

I would like to have a input box, get user input regarding the server IP address.

But get this error:

Microsoft VBScript compilation error: Expected literal constant

Lookup on MSDN:

You declared a constant, but assigned it a variable expression (a value that can change). Constants cannot contain runtime code.
To correct this error

  • Do not use expressions when declaring constants.

Would like to have Const BU_Server - result1

Now it is set for this:

Const BU_SERVER = "http://10.72.24.10"

All that I want is to be able to have the user input the server ip address and replace the varible, so is a const, not the right command for this?

Thanks,

Mike

< Message edited by netman06 -- 5/8/2007 4:39:46 AM >
 
 
Post #: 1
 
 RE: Const Question - 5/8/2007 4:38:45 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
A constant is just that...constant. If you are trying to make its value different at run time then it is not a constant it is a variable and you should not use the Const keyword.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to netman06)
 
 
Post #: 2
 
 RE: Const Question - 5/8/2007 4:57:47 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
Did you know Target Corporation owns 10.x.x.x the whole address space.

A constant should not change it should be well, constant.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Const Question - 5/8/2007 5:02:32 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Did you know that every large corporation owns 10.xx.xx.xx? It is a convention for ip addressing on internal networks. Gee I wonder where you work?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to mcds99)
 
 
Post #: 4
 
 RE: Const Question - 5/8/2007 5:19:00 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
netman06 :
In answer to your question, you can do what you want and have a constant contain the output of a variable.  To do so, you have to get funky with ExecuteGlobal

      

Hope that helps.

//EDIT: Removed span tags in code area - dm_4ever

< Message edited by dm_4ever -- 5/30/2007 2:28:36 PM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Const Question - 5/8/2007 5:24:05 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Aw man...I wasn't going to go to that particular hack.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 6
 
 RE: Const Question - 5/8/2007 6:42:13 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
I know.  Just like I knew how much it would drive you crazy to see it posted again.  Which is a large part of why I did it.  I could hear the groan from here.
Your irrational fear of ExecuteGlobal will be your downfall!  MUAHAHAHAHAHAHAHHA!!!!



_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Const Question - 5/8/2007 6:48:44 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Probably.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 8
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Const Question Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts