http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
The documentation provided lists the program as being accessible from the C prompt however the command line C:\screnc inputfile.sct outputfile.sct lists the program as " 'srenc' is not recognized as an internal or external command,etc... "
What am I doing wrong?
You need to open the command prompt on the folder where screnc.exe is
installed (or add that folder to the PATH environment variable). You'll
need to fully qualify the path to the script.
You don't really need scrence.exe to encode scripts (assuming you have a
relatively current version of WSH installed).
Here's a working encoder script that I use as a drag/drop target to encode
scripts...
'=== ScriptEncoder.vbs ===
filename = wscript.arguments(0)
set shell = createobject("wscript.shell")
set fso = createobject("scripting.filesystemobject")
defExt = "." & lcase(fso.getExtensionname(filename))
defLanguage = ""
cFlags = 0
'Note: cFlags has meaning only for ASP pages...
'
'cFlags = 0 '0x0 adds <%@ LANGUAGE=VBScript.Encode%> directive
'cFlags = 1 '0x1 adds <%@ LANGUAGE=defLanguage.Encode%> directive
'cFlags = 2 '0x2 suppresses <%@ LANGUAGE="..."%> directive
if defExt = ".vbs" _
or defExt = ".js" _
or defExt = ".wsf" _
or defExt = ".asp" then
'OK...
else
msgbox "Not a .vbs, .js, .wsf, or .asp file..."
wscript.quit
end if
if defExt = ".vbs" then
outfile = replace(filename,".vbs",".vbe")
defLanguage = "vbscript"
elseif defExt = ".js" then
outfile = replace(filename,".js",".jse")
defLanguage = "jscript"
elseif defExt = ".asp" then
outfile = replace(filename,".asp",".encode.asp")
defLanguage = "vbscript"
else
outfile = replace(filename,".wsf",".encode.ws")
defLanguage = "vbscript"
defExt = "html"
end if
set Encoder = createobject("Scripting.Encoder")
with fso.opentextfile(filename)
code = .read(fso.getfile(filename).size)
end with
on error resume next
encodedscript = Encoder.EncodeScriptFile(_
defExt, code, clng(cFlags), defLanguage)
If err = 0 then
On error GoTo 0
fso.opentextfile(outfile,2,true).write encodedscript
msgbox "Encoded script written to: " & outfile
else
msgbox "Encoding error: 0x" & hex(err.number) & vbcrlf _
& "Description: " & err.description,vbSystemModal
On error GoTo 0
end if
--
Michael Harris
Microsoft.MVP.Scripting
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
TechNet Script Center Sample Scripts
http://www.microsoft.com/technet/scriptcenter/default.asp
Download in HTML Help format (searchable and indexed)
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942
WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
Just CD to the directory in which you installed screnc.exe.
--
Ray at home
Microsoft ASP MVP
"RA" <answer(remove-parenthesis)@robin-ann.com> wrote in message
news:9AF7EE6D-370F-466A...@microsoft.com...
I would like your drag and drop script. I however am quite new to this
and wonder how to execute the method.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I copied the program to C and it works beautiful.
Many thanks.
Robin-Ann
Just copy the script code I posted and paste it into your own script file.
I named mine ScriptEncoder.vbs.
Create a shortcut to ScriptEncoder.vbs and put the shortcut on the desktop.
To sign a script, just drag/drop it onto that shortcut.
Or you can put the shortcut in the SendTo folder
(C:\Documents and Settings\username\SendTo)
This is a hidden folder, so you may not be able to see it unless you change
your folder options to show hidden files/folders.
Once the shortcut is in the SendTo folder, you can encode a script by right
clicking on the script and then choosing your shortcut from the Send To
context menu.
Simple:
start-run-SendTo
(without modifying folder options)
--
Marco
Thank you for the great script :) I figured out how to make it work in
my config.
I really appreciate your attention. I am so very happy now.
Sincerely,
Robin Ann