Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Vbscript coding question

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Vbscript coding 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 >>
 Vbscript coding question - 3/5/2008 8:59:17 AM   
  netman06

 

Posts: 107
Score: 0
Joined: 10/19/2006
Status: offline
Hello,
 
I would like to know if there is a way the you can consolidate your code that is grouped together, so that you can collapse it, for easy viewing.
 
I have only used one thing that I know of is the Function command or what ever you call it.
 
So that you have the plus or minus, just like windows explorer, you can expand or collapse directories.
 
Thanks,
 
-Mike
 
 
 
 
 
Post #: 1
 
 RE: Vbscript coding question - 3/5/2008 9:11:40 AM   
  ebgreen


Posts: 4972
Score: 31
Joined: 7/12/2005
Status: offline
That would be a function of the editor that you use not a function of VBScript itself.

_____________________________

"... 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: Vbscript coding question - 3/5/2008 9:30:28 AM   
  netman06

 

Posts: 107
Score: 0
Joined: 10/19/2006
Status: offline
So the Function used like this, is the editor and not vbscript?

Function GetCustomDate
  GetCustomDate = Right("00" & Month(Now()), 2) & _
                  Right("00" & Day(Now()), 2) & _
                  Right("00" & Year(Now()), 2)
End Function

So the top function has a plus sign to the left and you can collapse it if you wanted to just see:

Function GetCustomDate

Does this make sense?

Thanks,

Mike

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Vbscript coding question - 3/5/2008 9:34:16 AM   
  ebgreen


Posts: 4972
Score: 31
Joined: 7/12/2005
Status: offline
The Function as a coding construct is part of the language. The ability to have a + sign that collapses the function in your view is part of the editor. What editor are you using?

_____________________________

"... 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 #: 4
 
 RE: Vbscript coding question - 3/5/2008 9:43:55 AM   
  netman06

 

Posts: 107
Score: 0
Joined: 10/19/2006
Status: offline
Primal. So can I use the function as a formatter for my code, or is it a bad idea? Or is there any other way to perform this. I just have a script that is long and would like to make it easy to read.

Thanks,

Mike

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Vbscript coding question - 3/5/2008 9:51:04 AM   
  ebgreen


Posts: 4972
Score: 31
Joined: 7/12/2005
Status: offline
Keep the display of the code and the functional structure of the code seperate. Breaking your code up into functions can be a great thing if it is done well and done in a programtically safe and correct way. Just going through and adding Function/End Function lines indiscriminantly will break your code in a heart beat.

That little + sign that primal puts in refers to what primal calls "Code Regions". Primal creates code regions by default for Functions and Subs in VBScript. YOu can highlight a portion of the code and define your own code region as well. Just highlight the part of code that you want to be able to contract/expand then click the "Create Region" button on the toolbar.

_____________________________

"... 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 #: 6
 
 RE: Vbscript coding question - 3/5/2008 9:57:06 AM   
  netman06

 

Posts: 107
Score: 0
Joined: 10/19/2006
Status: offline
Thanks for the excellent explaination. You must have ESP, because that what I was going to do. But I wanted to check with the experts.

Thanks for the awesome tip on regions, I did not even know of this feature.

Take Care.

Thanks Again.

Mike

(in reply to ebgreen)
 
 
Post #: 7
 
 
 
  

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 >> Vbscript coding 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