Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > VBScript
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 3rd, 2011, 02:03 AM
Registered User
 
Join Date: Jul 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with wrox vbscript book

I have A problem.And the problem is that i m a complete beginner in vbscript and have no programming logic.But i learned the concept of vbscript from www.w3schools.com.This site provides a very good scripting technique for the beginners but i wanted more than available in that site.So,decided to buy a reference book to vbscript
and i bought the wileys vbscript a thick book,now it has been a very difficult to understand that book because all the examples provided in the Wileys vbscript Book are designed so that they can run using WSH..But i learned to put the vbscript code directly in html and run through browser ,the problem is that this book is not concerned with the beginner.This book do not provide the technique like that of w3schools.com.i m unable to pick up anything from this book.i m stopped in chapter 3.For Example in w3school functions of vbscript are all kept in the head section and are called through the body section .This is a good technique to keep function in the head section but when refered to wileys vbscript book such technique are't there.I couldnot get anything i expected...Can any one help me how should i utilize this book????.Now i m planning to buy the book that has the vbscript code embeded into html . May be i m the beginner and have no concept of using this book so your suggestion can save me buying the next book..What is the technique to use this book.The Wileys book also provide no technique of starting vbscript.I m suffering a lot.Please help me reduce this problem

Last edited by maizere; July 3rd, 2011 at 02:11 AM.
Reply With Quote
  #2 (permalink)  
Old April 17th, 2014, 07:22 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I learned GW-BASIC back in the 1990s from the book "Learning BASIC For Tandy Computers".

It was easy to learn from; and, was easy to find the Section that had answers you have questions about.

I have "VBScript Third Edition". It isn't as easy to learn from, or to find the Section that has answers to your questions, like "Learning BASIC For Tandy Computers". But, that is true with all of the Y2K Programming Language Reference Books that I have.

Windows Programming is way more complicated that DOS Programming.

Although I can't do GW-BASIC style of Graphics Programming with Visual BASIC Script, Visual BASIC Script does have a lot of good features and capabilities that GW-BASIC lacks; although, my own Computer Programming Activities don't require most of them.

I have always put my Subroutines & Functions at the bottom as a habit from my GW-BASIC Programming; because, GW-BASIC used Command Line Numbering; and, had limited amount of Byte Space for Individual Programs; which, isn't true for Y2K+ Script Programming Languages.

Windows Script Host uses NotePad Files with the ".vbs" Extension. The ".vbs" Files can only be seen, and Saved, with the "All Files" Option selected.

Windows Script Host won't RUN a NotePad File with Text that has Bold Characters & Italics Characters & Underlined Character & Mixed Fonts.

TO EDIT A VISUAL BASIC SCRIPT FILE IN NOTEPAD
Right-Click on the Visual Basic Script File.
Select "Open with...".
Select "Windows NotePad".

TO RUN A VISUAL BASIC SCRIPT FILE IN WINDOWS SCRIPT HOST
Right-Click on the Visual BASIC File.
Select "Open with...".
Select "Windows Script Host".

"VBScript Third Edition" does have a Section devoted to HTML and Website usage. But, that is beyond my Computer Programming Activities scope & interest.

CHAPTER 19: HTML APPLICATIONS
CHAPTER 20: SERVER-SIDE WEB SCRIPTING
CHAPTER 21: ADDING VBSCRIPT TO YOUR VB AND .NET APPLICATIONS

To be able to write Visual BASIC Script Code sequences, you need to read CHAPTER 4: VARIABLES AND PROCEDURES and CHAPTER 5: CONTROL OF FLOW.

Chapter 1 and Chapter 3 just gave the basic understanding of what Visual BASIC Script Code looks like; so that, you can Read VBS Code.
Reply With Quote
  #3 (permalink)  
Old April 18th, 2014, 04:45 AM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My largest VBS File is 208 KB in size.

Using 8-1/2"x14" Legal Paper in Landscape Orientation, it has 3752 Command Lines; which, includes White Space; and, prints out 42 Command Lines Per Page.

The top 1/3 of the Code is actually REM Command Lines that are devoted to Program Information (File Size & Computer System & Printer System & OS & Authors) and Table Of Contents and Authors' Notes and Edit Notes and other information.

The Actual Code Section is about 50 Pages in total. About 28 Pages are filled will Functional Code Sequences. The remaining pages are filled with REM Command Lines that Section the Code like Chapters in a book. About 3 Pages of these REM Command Lines are actually Game System Design Concept Tables.

Yea...An overabundance of REM Comments.

The Functional Code Sequences includes about 20 of my own Completed Function Sequences; and, about another 20 of my own Conceived Function Sequences that only have MsgBox Functions, and aren't Called by the Main Code Sections.

Because I can't do Visual Graphics Programming with Visual BASIC Script that I could do with GW-BASIC, my Visual BASIC Script Coding is basically simple VBS MsgBox Functions and simple VBS InputBox Function and simple Subroutines of my own creation like my "WorldTerrain" Function sequence listed below.

Code:
' D E C L A R E D   V A R I A B L E S

Dim dtmNumber     'Time generated by the "Time" Function during the RUNning of this Program / Multi-
 ' Generated
Dim dtmNumber0     'Time generated by the "Time" Function upon Starting this Program / Single-
 ' Generated
Dim dtmNumber1     'Time generated by the "Time" Function upon ENDing this Program / Single-
 ' Generated

Dim dtmSeed     'Seed Number generated by the "Time" Function during the RUNning of this Program /
 ' Multi-Generated
Dim dtmSeed0     'Seed Number generated by the "Time" Function upon Starting this Program / Single-
 ' Generated
Dim dtmSeed1     'Seed Number generated by adding the "dtmSeed"0" & "dtmSeed" Variables together /
 ' Multi-Generated

Dim ComputerGM     'Variable used for calling Game System Related Computer-Only Procedures

Dim TerrainType     'Variable used by the "WorldTerrain" Function for determing the Type Of Terrain
 ' Selected
Dim intTerrainType     'the Integer Value of the "TerrainType" Variable
Dim strTerrainType     'the String Value of the "TerrainType" Variable



' M A I N   P R O G R A M

'Computer Program Start Time
dtmNumber0 = Time
dtmSeed0 = Second(dtmNumber0)
MsgBox "C O M P U T E R   P R O G R A M   S T A R T   T I M E" & vbNewLine & vbNewLine & _
  "Time = " & dtmNumber0 & vbNewLine & _
  "Hour = " & Hour(dtmNumber0) & vbNewLine & _
  "Minute = " & Minute(dtmNumber0) & vbNewLine & _
  "Second = " & Second(dtmNumber0) & vbNewLine & vbNewLine & _
  "dtmSeed0 = " & dtmSeed0 & _
vbNewLine , , "[VBSplanetology.vbs]"

ComputerGM = WorldTerrain
MsgBox strTerrainType



' P R O G R A M   S E Q U E N C E S

Function WorldTerrain     'World Map Terrain Selection
	Randomizer = TimeSeeder     'using the "TimeSeeder" Function for generating a Random Seed
 ' Number
	Randomize dtmSeed1
	TerrainType = Rnd * 10
	intTerrainType = Int(TerrainType)
	If intTerrainType => 0 and intTerrainType =< 2 Then
		strTerrainType = "W"     'Water
	ElseIf intTerrainType = 3 or intTerrainType = 4 Then
		strTerrainType = "D"     'Dirt
	ElseIf intTerrainType = 5 or intTerrainType = 6 Then
		strTerrainType = "R"     'Rock
	ElseIf intTerrainType => 7 and intTerrainType =< 9 Then
		strTerrainType = "S"     'Sand
	Else
		MsgBox "Error -- 'WorldTerrain' Function" & _
		vbNewLine , , "[VBSplanetology.vbs]"
	End If     'intTerrainType
End Function     'World Terrain

Function TimeSeeder     'creates a Seed Number using the "Time" Function
	dtmNumber = Time
	dtmSeed = Second(dtmNumber)
	dtmSeed1 = dtmSeed0 + dtmSeed
	MsgBox "T I M E   S E E D E R" & vbNewLine & _
	  "Time = " & dtmNumber & vbNewLine & _
	  "Hour = " & Hour(dtmNumber) & vbNewLine & _
	  "Minute = " & Minute(dtmNumber) & vbNewLine & _
	  "Second = " & Second(dtmNumber) & vbNewLine & vbNewLine & _
	  "dtmSeed0 = " & dtmSeed0 & vbNewLine & _
	  "dtmSeed = " & dtmSeed & vbNewLine & _
	  "dtmSeed1 = " & dtmSeed1 & _
	vbNewLine , , "[VBSplanetology.vbs]"
End Function     'TimeSeeder
NOTE: I don't use the "Option Explicit" Command in my VBS Codes.

NOTE: I use the term "Sequences"; because, Subroutines & my own Function sequences go in this Section.
Reply With Quote
  #4 (permalink)  
Old April 25th, 2014, 03:11 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

?Did you read the "Introduction" Section?

With Literary Novels, one doesn't need to read the "Preface" Sections (those Sections that precede Chapter 1).

With Reference Books like "VBScript" and "Jane's Book Of Ships", one does need to read the "Preface" Sections (those Sections that precede Chapter 1) to have a better understanding of what is being communicated within the Reference Book being read.

This is true regardless of one's Programming Skill Level.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

I have Beginner Code Books for various Y2K+ Computer Programming Languages like C++.

Even though I can't write C++ Code, looking at C++, I can get a general drift of what the C++ Code is doing.

C++ uses a lot of "Black Box" Coding.

HTML & Web Coding also uses a lot of "Black Box" Coding.

"VBScript" won't help you to understand, or to crack, "Black Box" Code Sequencing.
Reply With Quote
  #5 (permalink)  
Old April 25th, 2014, 04:37 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe what you need to do is expand your Computer Programming Experience into other Computer Programming Languages in order to better understand "Visual BASIC Script" (which is different from "Visual BASIC".

"Visual BASIC" is an IDE that works with the Windows GUI System. The Computer Programmer is able to manipulate the Windows Environment & Windows 3D Objects with "Visual BASIC".

"Visual BASIC Script" is an Computer Programming Language that works with the "Visual BASIC" IDE. The Computer Programmer is able to create Custom Sequences for Events within the Visual BASIC IDE; thereby, indirectly affecting the Windows Environment & Widows 3D Objects via "Visual BASIC Script". "Visual BASIC Script" is primary used for creating User-Interactive Message Boxes and Input Boxes that appear within the Windows Environment.

Computer Programming Languages are like Human Languages: Diverse In Rules; but, can be grouped into Language Styles.

EXAMPLE ONE: Adjectives & Adverbs are before the Noun/Verb; Adjectives & Adverbs are after the Noun/Verb; all Nouns (including Inanimate Objects) are classified as being Male or Female; only Lifeforms are identified as being Male or Female based on the Lifeform's Gender

EXAMPLE TWO: English Language Group; Spanish Language Group; American English is different from British English is different from Australian English; Spain's Spanish is different from Mexico's Spanish is different from Brazil's Spanish.

In 2008, I purchased "Beginning Programming For Dummies" and "SAMS Teach Yourself Beginning Programming in 24 Hours" to replace GW-BASIC.

These books came with Compiler CDs (which was a requirement for my purchase) that has Demo Versions of a number of different Computer Programming Languages.

"Beginning Programming For Dummies" has "LibertyBASIC" and "REALbasic" and "C++" and "Revolution".

"SAMS Teach Yourself Beginning Programming In 24 Hours" has "Java" and "LibertyBASIC" and "Visual BASIC" and "C / C++".
Reply With Quote
  #6 (permalink)  
Old May 1st, 2014, 08:09 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by maizere View Post

So,decided to buy a reference book to vbscript
and i bought the wileys vbscript a thick book,now it has been a very difficult to understand that book because all the examples provided in the Wileys vbscript Book are designed so that they can run using WSH..But i learned to put the vbscript code directly in html and run through browser ,the problem is that this book is not concerned with the beginner.
I have very Limited HTML Experience; which, was around 1998 thru 2002.

I have no Browser Programming Experience.

My Pre-VBScript Programming Experience was primarily within the Windows Command Prompt and DOS Command Prompt.

"VBSCript Third Edition" touches on Programming with HTML; but, that is beyond my VBScript Projects; so, I know nothing about it.

"VBScript Third Edition" touches Programming within the Command Prompt; but, I haven't studied it in detail.

"VBScript Third Edition" is mostly based on the Programmer using NotePad, and/or other similar Text Editors, as the Programming Platform.



Quote:
Originally Posted by maizere View Post

This book do not provide the technique like that of w3schools.com.i m unable to pick up anything from this book.i m stopped in chapter 3.For Example in w3school functions of vbscript are all kept in the head section and are called through the body section .This is a good technique to keep function in the head section but when refered to wileys vbscript book such technique are't there.
Actually, "VBScript Third Edition" isn't concerned with how you organize your Code; because, every Programmer has one's own style of Code Organization.

"APPENDIX C: CODING CONVENTIONS" is more important than where a Prograamer puts Variable & Constant Declarations and Subroutine Blocks and Function Blocks within the Code.

The important thing is not to make "Spaghetti Codes"; and, to be consistent with all of your Codes.

There is nothing to stop you from writing the Published Code Sequences using your own Code Organization Style; although, doing this would complicate the proofreading of your Code with the Published Code.

The Published Code Sequences within "VBS Script Third Edition" aren't designed for you to use them in your Real Life VBScript Projects; but, are designed to be Study Models for how to use VBScript Commands.

So, you may want to follow the "VBScript Third Edition" Organization Model with your own Code Writing Organization Style; or, just keep reminding yourself that their Code Organization Theory is different from your own, or from what you are used to; and, live with that reality.

"VBScript Third Edition" is lacking some Basic Examples of how to sequence some VBScript Commands. This is due Veteran Programmers forgetting what it was like being Newbie Programmers.



Quote:
Originally Posted by maizere View Post

I couldnot get anything i expected...Can any one help me how should i utilize this book????.Now i m planning to buy the book that has the vbscript code embeded into html . May be i m the beginner and have no concept of using this book so your suggestion can save me buying the next book..What is the technique to use this book.
All Reference Books of this nature, which includes School Books, are designed to cover Specific Topics within Specific Section within the book. The Specific Topics can be looked for within the Table Of Contents and within the Index.

Also, sometimes a Section refers to another Section for additional information concerning a Specific Topic.

Sometimes, a Specific Topic is covered in multiple Sections, with each Section focused on a different aspect of the Specific Topic.

However, I have found that "VBScript Third Edition" is seriously lacking in Referencing Basic VBScript Programming Concepts in all three areas of Referencing.



Quote:
Originally Posted by maizere View Post

The Wileys book also provide no technique of starting vbscript.I m suffering a lot.Please help me reduce this problem
As previously mentioned, "VBScript Third Edition" assumes that you are using NotePad, or some other similar Text Editor, as your Code Writing Platform.

Windows Script Host uses NotePad, and similar Text Editors, as a Computer Programming Language Platform.

Let's say that you save your VBS Files in a Folder on your Computer.

If that Folder is on your Desktop; then, all you have to do is Open that Desktop Folder; and, you will see your VBS Files; as long as, your File Search Mode is set at "All Files".

If your File Search is "Only .txt Files"; then, you won't see your VBS Files.

NOTE: Your VBS File must have the ".vbs" extension; and, not the ".txt" Extension in order for the Windows Script Host to RUN your VBS File. This means that you must use "Save As"; and, type ".vbs" with your VBS File Name; and, have the File Setting on "All Files".

If your VBS File does have the ".vbs" Extension; then, you can RUN that File by Clicking on it.

Left-Clicking the VBS File may activate the Windows Script Host; or, activate the NotePad/Text Editor you used to Write the Code; depending upon, what you did with that VBS File the last time you Activated it.

Right-Clicking the VBS File allows you better control of Activating the File for Running or for Editing; but, the process is longer and more complicated.

When you Right-Click on the VBS File, a Menu will Open giving you Options.

The Bold Text "Open" will either RUN the VBS File via the Windows Script Host; or, it will Open the NotePad/Text Editor that you used to Write/Edit the VBS File; depending upon, what you did the last time you Activated the VBS File.

The Standard Text "Open" Option will Open another Menu giving you choices of how to access the VBS Files based on your Previous Activation Choices.

My Standard Text "Open" Option Menu Choices are (1) Windows Script Host; and, (2) NotePad. I don't use any other means of accessing my VBS Files; therefore, I don't have another other Menu Option Choices.

To RUN the VBS File choose the "Windows Script Host" Option.
To Edit the VBS File; or, to Copy the VBS File to create a New VBS File, choose the "NotePad/Text Editor that you use" Option.

If you have never before accessed the VBS File on the Computer System; then, that Computer System will ask you for which Format to use to Open the VBS File; as well as, whether to use that Choice every time you access the VBS File.
Reply With Quote
  #7 (permalink)  
Old May 6th, 2014, 06:21 PM
Authorized User
Points: 129, Level: 2
Points: 129, Level: 2 Points: 129, Level: 2 Points: 129, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by maizere View Post

I have A problem.And the problem is that i m a complete beginner in vbscript and have no programming logic.But i learned the concept of vbscript from www.w3schools.com.This site provides a very good scripting technique for the beginners but i wanted more than available in that site.So,decided to buy a reference book to vbscript
and i bought the wileys vbscript a thick book,now it has been a very difficult to understand that book because all the examples provided in the Wileys vbscript Book are designed so that they can run using WSH..But i learned to put the vbscript code directly in html and run through browser ,the problem is that this book is not concerned with the beginner.
Quote:
Originally Posted by maizere View Post

I couldnot get anything i expected...Can any one help me how should i utilize this book????.Now i m planning to buy the book that has the vbscript code embeded into html . May be i m the beginner and have no concept of using this book so your suggestion can save me buying the next book..What is the technique to use this book.
One of the major problems that I have with "VBScript Third Edition", and with all Y2K Computer Language Reference Books like "VBScript Third Edition" is...

...Amongst the Computer Programmer Community, at least according to the Book Publishing Companies, there is no consistent terminology concerning Blocks Of Code.

EXAMPLE: "Learning BASIC For Tandy Computers" uses the term "Routine" for the Programming Sequences within the Main Section of the Code.; while, "VBScript Third Edition" uses the term "Sequences".

EXAMPLE: "Learning BASIC For Tandy Computers" uses the term "Subroutine" for Blocks Of Code like "For...Next" Loops and "Do...While" Loops; while, "VBScript Third Edition" uses the terms "Function" and "Subsquences" depending upon whether, or not, the Block Of Code produces New Variable Values.

EXAMPLE: Both "Learning BASIC For Tandy Computers" and "VBScript Third Edition" use the term "Function" for Core Command Words like "PRINT" and "MsgBox" and "INPUT" and "InputBox" and "SUB". NOTE: GW-BASIC and Visual BASIC Script have very few common Command Words.

This issue has nothing to do with the actual Code Writing; but, it is essential for Communication about Code Writing between Computer Programmers; and Book Authors and Book Readers on the subject of Computer Language Code Writing.

This issue may be more relevant to the Book Publishing Companies than to the actual Computer Programmers; because, I have encountered similar Terminology Issues concerning an Educational Book relating to Aircraft Design.

The book in question is "Introduction To Aircraft Performance, Selection, & Design" by Francis J. Hale (c)1984 John Wiley & Sons, Inc.

While Francis J Hale was using terminology like "Fuselage Center Of Gravity" for describing an equation, and/or Aerodynamic Theory, the Book Publishers used phrases like "Center Of Gravity for the Fuselage".

This made understanding what Francis J Hale was writing very complicated; even though, the concepts that Francis J Hale was communicating was the simplest possible; or, the concepts was complicated because of factors like Fuselage cg affects, and is affected by, Wing cg.

My father is a Certified Hydraulic Engineer with a Bachelors Of Science Degree in Hydraulics. Thus, I am familiar with Professional Engineering Terminology; which, the John Wiley & Sons, Inc. Book Editors obviously weren't.

This raises another question that I have been having since I have been revisiting this Topic Thread...

?How old are you?

A High School Teenager, or a younger person, may easily get confused by the Grammar used within "VBScript"; that is, assuming that you are an American-Born USA Civilian; and not, a Non-American Visitor, or an American-Born Foreigner, who speaks English as one's "Second" Language.

In the case that American English is your "Second" Language; then, all I can say is practice Reading & Writing & Speaking American English to gain better mastery of the American English Language.

NOTE: My American English Writing Grammar (especially concerning Capitalization) is a deviation from Established Proper USA Capitalization System.

NOTE: My own Thought Processes tend towards the Compound-Complex Sentence Structure; which, confuses most American-Born Civilians (like myself) who speak American English as their "Native" ("First") Language.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi Wrox! do you hava a book re... JakeSpeed Wrox Book Feedback 0 November 6th, 2006 10:28 AM
Problem with code in wrox book isgamon2004 JSP Basics 2 May 13th, 2006 02:16 PM
C# 2005 Wrox Book? pro-logic C# 2005 3 October 15th, 2004 12:36 AM
i need to know the new edition of wrox book toon Wrox Book Feedback 1 September 23rd, 2004 02:05 AM
Problem with code in wrox book.... wvmikep JSP Basics 2 August 24th, 2004 05:31 AM



All times are GMT -4. The time now is 06:49 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.