Title: Message
I was able
to do some more research on MSDN and found JSCRIPT code
that was
similar on what I had found for the _vbscript_ that
used windows
host scripting and some shell commands. I played
around a
little bit to get the JSCRIPT code to work in a file by
itself,
saving the code in file with .js extension. Below is
what I was
able to get using _vbscript_ and JSCRIPT. I do not
know either
one. I just compared the 2 examples and this is
what I
got.
Here is a
link to MSDN for creating shortcuts using windows host
scripting
and shell commands.
Here
is 2 examples.
#2 _vbscript_
passing in 2 parameters to create desktop
shortcut
Set ArgObj =
WScript.Arguments
Set WshShell =
CreateObject("WScript.Shell")
strDesktopPath =
WshShell.SpecialFolders("Desktop")
urlname = ArgObj(1)
Set objShortcutUrl
= WshShell.CreateShortcut(strDesktopPath & "\" & urlname &
".url")
objShortcutUrl.TargetPath =
ArgObj(2)
objShortcutUrl.Save
#2 jscript
passing in 2 parameters to create desktop shortcut
ArgObj =
WScript.Arguments
WshShell = new
ActiveXObject("WScript.Shell");
strDesktopPath =
WshShell.SpecialFolders("Desktop");
urlname = ArgObj(0);
objShortcutUrl =
WshShell.CreateShortcut(strDesktopPath + "\\" + urlname +
".url");
objShortcutUrl.TargetPath =
ArgObj(1);
objShortcutUrl.Save();
JUST
REMEMBER THAT THE SCRIPTING STARTS AT 0 (ZERO) FOR THE
ARGUMENTS
FOR SOME
REASON. MUST BE LIKE VB, STARTS AT ZERO.......
to run
command prompt session: 1.
open command prompt session and navigate to the
file
folder where jscript batch file is
I figured
out that for some reason to run a jscript and if you have
spaces
within a file folder name, it don't like it. I just renamed 'my stuff'
file folder
to 'mystuff'
file folder and ran it.
Christina
Crawford
-----Original Message-----
From:
Andy Johnstone [mailto:[EMAIL PROTECTED]
Sent: Thursday,
March 16, 2006 12:02 PM
To: Crawford, Christina
Subject: RE:
[NAnt-users] Put _vbscript_ batch file code within NAnt
Christina,
You
could use that to create your own code which could be embedded in nant via the
Script task.
HTH
Andy
I read
somewhere within the NAnt or NAntContrib mailing lists
that it was
mentioned to put the _vbscript_ batch file into
an NAnt
build file. So, it must be able to be done somehow.
I do not
know how to convert the _vbscript_ code into a VB.NET code.
I am not
familiar with _vbscript_ enough.
Can you tell
me what the different language options mean for
VJS, vjs,
and is the VB and vb for visual basic 6.0 or .NET?
Here are
some _vbscript_'s examples I found to use as examples to create
shortcuts
that I would like to try to embed into my NAnt build script
rather than
using the NAnt exec task.
1. create
desktop shortcut to activate notepad and use a special icon
Set WshShell
= CreateObject("Wscript.shell")
strDesktop =
WshShell.SpecialFolders("Desktop")
Set oMyShortcut =
WshShell.CreateShortcut(strDesktop + "\Sample.lnk")
oMyShortcut.WindowStyle =
3 '&&Maximized 7=Minimized
4=Normal
oMyShortcut.IconLocation = "C:\myicon.ico"
OMyShortcut.TargetPath
= "%windir%\notepad.exe"
oMyShortCut.Hotkey =
"ALT+CTRL+F"
oMyShortCut.Save
2.
create a desktop shortcut for a internet website, passing 2 parameters to the
parameter is just a name
and the second parameter is the actual internet url.
Set ArgObj =
WScript.Arguments
Set WshShell =
CreateObject("WScript.Shell")
strDesktopPath =
WshShell.SpecialFolders("Desktop")
urlname = ArgObj(1)
Set objShortcutUrl
= WshShell.CreateShortcut(strDesktopPath & "\" & urlname &
".url")
objShortcutUrl.TargetPath =
ArgObj(2)
objShortcutUrl.Save
3.
Same as #2 to create desktop shortcut but hardcoding the
values.
WshShell =
CreateObject("WScript.Shell")
strDesktop =
WshShell.SpecialFolders("Desktop")
oUrlLink =
WshShell.CreateShortcut(strDesktop+"\Microsoft Web
Site.URL")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save
4.
Create a shortcut and place it within a file folder.
'Create a
WshShell Object
Set WshShell =
Wscript.CreateObject("Wscript.Shell")
'Create a
WshShortcut Object
Set oShellLink =
WshShell.CreateShortcut("aaa.lnk")
'Set the
Target Path for the shortcut
oShellLink.TargetPath =
"notepad.exe"
'Set the
additional parameters for the shortcut
oShellLink.Arguments =
"c:\windows\desktop\aaa.txt"
'Save the
shortcut
oShellLink.Save
'Clean up
the WshShortcut Object
'Set oShellLink = Nothing
Christina Crawford
-----Original Message-----
From:
Crawford, Christina
Sent: Wednesday, March 15, 2006 3:57
PM
To: 'Andy Johnstone'
Subject: RE: [NAnt-users] Put
_vbscript_ batch file code within NAnt
I am
currently trying to replace an MSI folder setup project process
developed
within
Visual Studio for VB .NET 2003 that is in the same solution as the
original
application using NAnt or NAntContrib. I have to
do this
because we are giving out our application to Trading Partners and
can't
give out MSI
files. I don't understand the MSM and MSI
tasks/functions.
All I have
to do is it build the projects to create the dll's and put
them
and some
other documents into a Program Files . Then, create desktop
shortcuts.
Then create another file folder to put into the Start Programs area
and place
three
shortcuts there.
I can do the
build OK but can't figure out how to create the shortcuts.
I searched
the internet and MSDN and found some _vbscript_ code that work
great.
I can call them using the NAnt exec task but would to embed
them into
the NAnt build file.
I am trying
to create desktop shortcuts and also shortcuts to go within
a Program
Files folder using NAnt or NAntContrib functions/tasks. I
could
not find
one.
Christina Crawford
Don't
think you can embed _vbscript_ into the build, but you could certainly call
it.
HTH
Andy
How would one go about including _vbscript_
batch file code and
Embedding it
within an Nant build file? Can Nant script task
Be used in some way? I would also like to pass
parameters into the
Embedded code and
receive parameters out of the embedded code.
I currently am working on just using the Nant exec
task to execute
The existing
_vbscript_. I have to figure out how to pass parameters into
The Nant exec task into the _vbscript_ batch
file and receive parameters
Back to
save to an Nant project name for use later in the Nant build file.