Function in vb script

rajani created the topic: function in vb script

Develop a function that accepts a string of names separated by comma add those names in an array and display the names added in the array.

rajeshkumar replied the topic: function in vb script

Welcome to board….

try following snippet…

Sub Funstr("str1", "str2")

a=Array(str1,str2)
document.write(a(0))
document.write(a(1))
End Sub

I would recommend you going through this url as well to learn more about it……

www.functionx.com/vbscript/Lesson06.htm

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajani replied the topic: function in vb script

it won’t work
i have write
“Develop a function that accepts a string of names separated by comma (example given below), add those names in an array and display the names added in the array”

Example: rajani; Disha; Dhara; Hunny ;moon
without using split function
can i use mid function

rajani replied the topic: function in vb script

i am able to display name but with comma
Dim fruits()
ReDim fruits(100)
nofruits=0
‘we do not know how many fruit names we are going to enter and so, we have declared the array size as 100
For i=0 to 100
fruits(i)=inputbox(“Enter the name of a fruit separated by comma”)
ans = MsgBox(“Do you want to continue”, vbYesNo, “Confirm Continuation…”)
If ans=vbNo Then
Exit For
End If
nofruits=nofruits+1
Next
ReDim Preserve fruits(nofruits)
‘Redim keyword resets the number of elements that can be accommodated in the array.

fruitnames=””

For each fruit in fruits
‘Using For Each Next we have displayed all the names of the fruits which was entered and kept in fruits array.
‘For Each Next extracts the fruit names stored in the array and msgbox displays the output.

fruitnames=fruitnames&fruit&vbnewline
Next

msgbox fruitnames

rajani replied the topic: function in vb script

any suggestion

rajani replied the topic: function in vb script

dim Array, Str1,X
Str1 = “Neha; Swati; Disha; Sonya; Dhara”
Array = split(Str1,”;”)
for each x in Array
message = message & x & vbCRLF
next
msgbox message

Tagged :

Throw new Error(‘npm.load() required’)

rajeshkumar created the topic: throw new Error(‘npm.load() required’)

Error:

C:\Program Files\nodejs\node_modules\npm\lib\npm.js:37
throw new Error(‘npm.load() required’)
^
Error: npm.load() required
at Object.npm.config.get (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:37:11)
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:49:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:314:3)
at process.EventEmitter.emit (events.js:95:17)
at process._fatalException (node.js:272:26)
Build step ‘Execute Windows batch command’ marked build as failure

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Check the exit code of the last command in batch file?

rajeshkumar created the topic: check the exit code of the last command in batch file?

Test for a return code greater than or equal to 1:

if ERRORLEVEL 1 echo Error
or

if %ERRORLEVEL% GEQ 1 echo Error

or test for a return code equal to 0:

if %ERRORLEVEL% EQU 0 echo OK

You can use other commands such as GOTO where I show echo
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Get the application exit code from a Windows command line?

rajeshkumar created the topic: get the application exit code from a Windows command line?

Two ways…

(1) The results are stored in a pseudo environment variable named errorlevel so…

echo Exit Code is %errorlevel%
(2) and a special syntax of the if command:

if errorlevel
see if /? for details.

For Example

@echo off
my_nify_exe.exe
if errorlevel 1 (
echo Failure Reason Given is %errorlevel%
exit /b %errorlevel%
)
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: get the application exit code from a Windows command line?

:: Exit if a required file is missing
@echo off
If not exist MyimportantFile.txt Exit /b
Echo If we get this far the file was found

:: Set the error level to 5
@echo off
call :setError
echo %errorlevel%
goto :eof

:setError
Exit /B 5

To make this more flexible you can change the subroutine to set any errorlevel like this:

:setError
Exit /B %1

Now you can call the subroutine: call :setError 6 replacing 6 with whatever value you need the errorlevel to be set to.

EXIT is an internal command.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Create a txt file using batch file in a specific folder

rajeshkumar created the topic: Create a txt file using batch file in a specific folder

@echo off
echo.>”d:\testing\dblank.txt”
This creates a file containing a blank line (CR + LF = 2 bytes).

If you want the file empty (0 bytes)

@echo off
break>”d:\testing\dblank.txt”
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Delete files and folder using batch commands…

rajeshkumar created the topic: Delete files and folder using batch commands…

del /s /q bin – deletes all files recursively
rmdir bin – delete empty folders..

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Debut Video Capture Batch Script Automation

rajeshkumar created the topic: Debut Video Capture Batch Script Automation

Debut Video Capture Batch Script Automation

Start Script

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Tools\start.bat" & Chr(34), 0
Set WshShell = Nothing

Stop Script

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Tools\stop.bat" & Chr(34), 0
Set WshShell = Nothing

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

rajeshkumar replied the topic: Debut Video Capture Batch Script Automation

et WshShell = CreateObject(“WScript.Shell”)
WshShell.Run chr(34) & “C:\Tools\start.bat” & Chr(34), 0
Set WshShell = Nothing

Set WshShell = CreateObject(“WScript.Shell”)
WshShell.Run chr(34) & “C:\Tools\stop.bat” & Chr(34), 0
Set WshShell = Nothing

Start.bat
C:\”Program Files (x86)”\”NCH Software”\Debut\debut.exe -record -hide

Stop.bat
C:\”Program Files (x86)”\”NCH Software”\Debut\debut.exe -stop -exit

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

ganjichandu@hotmail.com replied the topic: Debut Video Capture Batch Script Automation

hi this is chandu
i want some real time issues in Jenkins,svn,ant plz help this is my mail id :ganjichandu@hotmail.com
my mobile num :9912264978

Tagged :

Ant Script with Shell script, How to run shell script from Ant Script?

ant-script-with-shell-script

Ant Script with Shell script
How to set files Permission in Ant | How to set files Permission in Unix | Set files Permission in Ant in Unix Environment
Command:
 

 

Ant Script to Replace some character in any files
 

 

How to run shell script using ant/
 
To Remove Some Special Character from Files
for name in `find PWD -type f`
do
if [ -f $name ]; then
tr -d “\015” ${name}XXXYYYZZZ
mv ${name}XXXYYYZZZ $name
echo “$name updated”
fi
done

 

Tagged : / / / / / / / / / / /