Showing posts with label VB Script. Show all posts
Showing posts with label VB Script. Show all posts

Friday, 27 April 2018

How to find system IP Address by VBScript (Program)

IP Address by VB Script

Step1- Open Notepad.
Step2- Write the Program.


dim DTC1, DTC, StrIP

Set DTC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

For Each DTC in DTC1

if DTC.IPEnabled then

StrIP = DTC.IPAddress(i)
  
MsgBox "IP Address:  "&StrIP 

wscript.quit

end if

next

Step3- Save this program as .vbs

OUTPUT:-



Download VBS Code-  Click Here

Friday, 29 December 2017

Natural numbers in Reverse order by VBscripting

Hello Friends,
in this, i am giving you code of VBScripting code for making reverse order of Natural numbers..
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.



//
dim num,n
n=inputbox ("Enter a value")
for num=n to 1 step -1
msgbox num
next

//

Download - Click Here

writing Natural number in text file by VBscripting

Hello Friends,
in this, i am giving you code for writing Natural number in text file by VBscripting .
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.



//
dim num,n,fso,myfile
n=inputbox("Enter the value")
num=1
for num=1 to n step 1
set fso=createobject("scripting.filesystemobject")
set myfile=fso.opentextfile ("D:\designtechacademy.txt",8,true)
myfile.writeline num
myfile.close
next

//

Download - Click Here

Find Even numbers upto n value by VBScripting.

Hello Friends,
in this, i am giving you code for Finding Even numbers upto n value by VBScripting.
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.


//
dim num,n
n=inputbox ("Enter a value")
for num=2 to n step 2
msgbox num

next

//


Download - Click Here

Find ODD numbers upto n value by VBScripting

Hello Friends,
in this, i am giving you code for Finding ODD numbers upto n value by VBScripting.
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.


//
dim num,n
n=inputbox ("Enter a value")
for num=1 to n step 2
msgbox num

next

//

Download - Click Here

Display reverse order from 4 digits number by vbscripting

Hello Friends,
in this, i am giving you code of VBScripting code for finding Reverse order from giving 4 digits numbers.
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.


//
dim num,rev
num=inputbox ("Enter a number")
if len(num)=4 then
rev=rev*10+num mod 10
num=num/10
num=left(num,3)
rev=rev*10+num mod 10
num=num/10
num=left(num,2)
rev=rev*10+num mod 10
num=num/10
num=left(num,1)
rev=rev*10+num mod 10
msgbox "Reverse order of the number is " &rev
else
msgbox "number, you entered is not 4 digit number"

end if

//

Download -  Click Here

How to find Leap year by VBScripting code

Hello Friends,
in this, i am giving you code of VBScripting code for finding Leap Year.
For using this code, Copy code from bellow attached then paste in Notepad and save it with extension *.vbs*.

//
dim xyear
xyear=inputbox ("Enter year")
if xyear mod 4=0 then
msgbox "This is a leap year"
else
msgbox "This is NOT leap year"

end if

//

Download Code -  Click Here

Sunday, 10 December 2017

Water Calculation for Body According to Weight


How much water do you need a day?

Water is an important structural component of skin cartilage, tissues and organs. For human beings, every part of the body is dependent on water. 
The average adult loses about 2.5 litres water daily through perspiration, breathing and elimination. Symptoms of the body's deterioration begins to appear when the body loses 5% of its total water volume. In a healthy adult, this is seen as fatigue and general discomfort, whereas for an infant, it can be dehydrating. In an elderly person, a 5% water loss causes the body chemistry to become abnormal, especially if the percentage of electrolytes is overbalanced with sodium.One can usually see symptoms of aging, such as wrinkles, lethargy and even disorientation. Continuous water loss over time will speed up aging as well as increase risks of diseases.
If your body is not sufficiently hydrated, the cells will draw water from your bloodstream, which will make your heart work harder. At the same time, the kidneys cannot purify blood effectively. When this happens, some of the kidney's workload is passed on to the liver and other organs, which may cause them to be severely stressed. Additionally, you may develop a number of minor health conditions such as constipation, dry and itchy skin, acne, nosebleeds, urinary tract infection, coughs, sneezing, sinus pressure, and headaches.
So, how much water is enough for you? The minimum amount of water you need depends on your body weight. A more accurate calculation, is to drink an ounce of water for every two pounds of body weight.
Here is the calculation for your minimum water need per day
*Your weight = W
=((W*2.2)/2/15)*450 ml
=((((W*2.2)/2/15)*450)/1000) liters



VBScript Code for calculations.
var1=cdbl(inputbox("Enter the Weight"))
msgbox "Water required in ml=" & (((var1*2.2)/2/15)*450)      & "  water required in liters =" & ((((var1*2.2)/2/15)*450)/1000)




Download VBScript - Click Here

Saturday, 10 June 2017

Catia run by VBScript

If you want to start/run CATIA by VBScript then it's easy by this program.
Just copy this program and save in ".vbs" format.

Program


Dim CATIA
Set CATIA = WScript.CreateObject("CATIA.Application")
CATIA.Visible=True

  
      




Download VBScript File- Click Here

                                Video Tutorial




Thursday, 27 April 2017

Odd/ Even Check by VB Script

Program

a=cint(inputbox ("enter the value of a"))
if (a mod 2 =0) then
msgbox "value is even"

else
msgbox "value is odd"
end if


Steps-
Step1-Open Notepad and write the program.
Step2- Save as this file- .vbs
Step3- open file and get output

Compare B/W Two Values by VB Script

Program

a=cint(inputbox ("enter the value of a"))
b=cint(inputbox("enter the value of b"))

if (a>b) then
msgbox "a is greater than b"

elseif (a<b) then
msgbox "a is smaller than b"

else
msgbox "a and b are same"

end if

Steps-
Step1-Open Notepad and write the program.
Step2- Save as this file- .vbs
Step3- open file and get output

Calculator in VB Script



Program

varchoice=lcase(inputbox("Enter your choice of operator, a-> addition s-> subtraction, d-> divide, i->integer division, e->exponential, mo=modulus"))
var1= cdbl(inputbox("Enter the first value"))
var2= cdbl(inputbox("Enter the second value"))

select case varchoice
case "a"
msgbox (var1+var2)
case "s"
msgbox (var1-var2)
case "d"
msgbox (var1/var2)
case "i"
msgbox (var1\var2)
case "e"
msgbox (var1^var2)
case "mo"
msgbox (var1 mod var2)

end select


Video Tutorial


Step1-Open Notepad and write the program.
Step2- Save as this file- .vbs
Step3- open file and get output


Sunday, 12 March 2017

ArithmeticOperator in VB Script

In this operator we use it for addition, subtraction etc.

Let Assume, a=5 and b=2

1-Adds two operands (+)
This operator is used to add (Sum) two values.

Ex-
                a=5
                b=2
                sum= a+b
               msgbox "Sum is = " & sum

Output-
                Sum is = 7


2-Subtraction (-)
Subtracts second operand from the first.

Ex-
                a=5
                b=2
                sub=a-b
                msgbox "value is = " &sub

Output-
              Value is = 3


3-Multiply (*)
This operator is used for multiple two values.

Ex-
                a=5
                              b=2
                multi=a*b
                msgbox " Value is = " &multi

Output-
              Value is = 10

4- Divide (/)
Divide Numerator by Denumerator.

Ex-
                 a=5
                 b=2
                div=a/b
               msgbox "value = " &div

Output-
              Value is = 2.5

5- Modulus (%)
Modulus Operator and remainder of after an integer division.

Ex-
                 a=5
                 b=2
                 mo=a mod b
                 msgbox "mod value is = " &mo

Output-
             mod value is = = 1

6-Exponentiation ( ^ )
Ex-
                    a=5
                    b=2
                   exp=a^b
                  msgbox "Exponentiation value = "& exp

Output-
              Exponentiation value = 25


Inputbox in VB Script

Inputbox


Inputbox in VB Script is used for getting value from user.
In Inputbox, we can take numerical or alphabet values.
Ex-1
                var1=inputbox ("Enter your text")
                msgbox var1
Save this program as .vbs


Output-


After given input text


Ex-2
                 var1=cint(inputbox("Enter the first value for sum"))
                 var2=cint( inputbox ("Enter the second value for sum"))
                 sum=var1+var2
                 msgbox "Sum of two input value is = " &sum

Save this program as .vbs format
*Here "cint" is used for read value as numerical value, if you will not use cint or other data type then it will read the input values as string and give the result of these input as merge the two values.




Friday, 10 March 2017

Operators in VB Script

Operators

VB Script has a full range of operators, including arithmetic operator, comparison operator, concatenation operators, and logical operators.

The Arithmetic Operators


OperatorDescriptionExample
+Adds two operandsA + B will give 15
-Subtracts second operand from the firstA - B will give -5
*Multiply both operandsA * B will give 50
/Divide numerator by denumeratorB / A will give 2
%Modulus Operator and remainder of after an integer divisionB MOD A will give 0
^Exponentiation OperatorB ^ A will give 100000

The Comparison Operators

OperatorDescriptionExample
==Checks if the value of two operands are equal or not, if yes then condition becomes true.(A == B) is False.
<>Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.(A <> B) is True.
>Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.(A > B) is False.
<Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.(A < B) is True.
>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.(A >= B) is False.
<=Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.(A <= B) is True.

The Logical Operators

OperatorDescriptionExample
ANDCalled Logical AND operator. If both the conditions are True then Expression becomes true.a<>0 AND b<>0 is False.
ORCalled Logical OR Operator. If any of the two conditions are True then condition becomes true.a<>0 OR b<>0 is true.
NOTCalled Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.NOT(a<>0 OR b<>0) is false.
XORCalled Logical Exclusion. It is the combination of NOT and OR Operator. If one, and only one, of the expressions evaluates to True, result is True.(a<>0 XOR b<>0) is false.

The Concatenation Operators

OperatorDescriptionExample
+Adds two Values as Variable Values are NumericA + B will give 15
&Concatenates two ValuesA & B will give 510
Assume variable A="Microsoft" and variable B="VBScript", then:
OperatorDescriptionExample
+Concatenates two ValuesA + B will give MicrosoftVBScript
&Concatenates two ValuesA & B will give MicrosoftVBScript

Data Type used in VB Script

subtypeDescription
BooleanLogical value:
true (numeric value is "nonzero", mostly -1) or
false (numeric value is 0)
See the notes below.
ByteInteger value (1 byte) in the range: 0 to 255.
IntegerInteger value (2 bytes) in the range: -32768 to 32767.
LongInteger value (4 bytes) in the range: -2,147,483,648 to 2,147,483,647.
SingleReal value (4 bytes) with the precision 7 digits in the range:
-3.402823E38 to -1.401298E-45 (negative values).
1.401298E-45 to 3.402823E38 (positive values).
Binary implementation format is according to standard IEEE-754 (32-bit)
DoubleReal value (8 bytes) with the precision 15 digits in the range:
-1.79769313486231E308 to -4.94065645841247E-324 (negative values).
4.94065645841247E-324 to 1.79769313486231E308 (positive values).
Binary implementation format is according to standard IEEE-754 (64-bit)
DateValue containing Date and time. See the notes below.
Stringtext string that can be up to approximately 2 billion characters in length in the Unicode character set.
Object"pointer" (reference) to any object.
ArrayArray of values. See How to use array of values in the PROMOTIC system.
EmptyFlag that value is uninitialized.
NullFlag that value intentionally contains no valid data.

Wednesday, 8 March 2017

Sum of Two values in VB Script

Sum of two value in VB Script

Step1- Open Notepad.
Step2- Write the Program.
a=5
b=10
c=a+b
msgbox "addition of a and b is  " & c

Step3- Save this program as .vbs


Input-


Output-







                                                     

Monday, 6 March 2017

Calculator by VB Script Tutorial



This video is related to VB Script in which we can select our required operation and get the output.
//
varchoice= lcase (inputbox ("Enter your choice of operation; a- addition , s- Subtraction, m-Multiplication, d- Division"))
a=cdbl(inputbox ("Enter the 1st value"))
b=cdbl(inputbox ("Enter the 2nd value"))

select case varchoice
 case "a"
 msgbox (a+b)
 case "s"
 msgbox (a-b)
 case "m"
 msgbox (a*b)
 case "d"
 msgbox (a/b)
 case else
 msgbox "Input is Wrong"
end select
//


                                                                         

Sunday, 5 March 2017

How to print by VB Script

Msgbox
If you want to print (show message ) something on screen then
use "msgbox" command.

Ex-
        msgbox " Design Tech Academy"

=> Double Quotes ( " ) - which message do you print that must be double quotes.

Output =>


Step1-Open Notepad and write the program.

                                              


Step2- Save as this file- .vbs

Step3- open file and get output.