I went around in circles trying to figure how to get nconvert.exe going in Classic ASP. The last time I used nconvert.exe in a MOD for a forum was over a decade ago in . Back then, the MOD creator used aspexec.dll to execute nconvert.exe, but things have changed since then. As for me, I am more of a "fix or create it as I need it" type of programmer, so I am not fully versed or fluent in any scripting or programming language, which makes it harder on me for stuff like this.
However, I finally did find a way to execute nconvert.exe locally though remotely I am currently having to work with my host on permissions. I didn't have that issue years ago with aspexec.dll. It was more or less plug and play at that time. The MOD confused me at the time too, but after I got it working, I left it to being happy that even got it to work. I have been with the same web host for about 16 years, so I am hoping he will help me on the permissions stuff.
Anyway, as I read on the these forums for help with this, I saw these notes in the post above ... "Batch scripting and using the command line is not trivial. There are many more possible problems and traps, far too many to list or explain here. Before posting a general problem regarding command line or batch scripting here, please try to find out a solution using the web." and "As written above "NConvert" is not as easy to use as XnView."
You are defintely not kidding!
But! I think there may be hope or us old Classic ASP folks! Maybe. Fingers crossed, right?
I'll try to update this post if I work out a solution with my host. Meanwhile, below is the code for my files that work on my local machine:
In the Classic ASP code below, the "cmd" command needed an & (amperstand) in order to consecutively execute separate DOS command line commands. First, one command needed to execute a change directory in order to find where nconvert.exe is located. Second, another command needed to execute nconvert.exe itself. That is where I was getting confused because that is DOS stuff and not vbscripting stuff nor Windows Host Script stuff. I found about the amperstand and using quotes for options (switches) here: https://ss64.com/nt/cmd.html
Below are my pages. I named this as aspexec.asp and aspexec.aspx for the sake of folks trying to find them in a search as well as for testing.
Code: Select all
aspexec.asp (Classic ASP) <% Sub Page_Load '1st test Dim objShell : Set objShell = CreateObject("Wscript.Shell") objshell.Run("cmd /k CD D:\Domains\yourwebsite.com\wwwroot\Xnview\ & D:\Domains\yourwebsite.com\wwwroot\Xnview\nconvert.exe -out jpeg -truecolors 10_fnl.gif") End Sub %> <!DOCTYPE html> <html> <body> <% Page_Load %> <h3>OK</h3> </body> </html>
Code: Select all
aspexec.aspx (.NET ASP) <%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Diagnostics" %> <%@ Import Namespace="System.ComponentModel" %> <script runat="server"> Sub Page_Load Dim myProcess As New Process() myProcess.StartInfo.UseShellExecute = False myProcess.StartInfo.FileName = "D:\Domains\yourwebsite.com\wwwroot\Xnview\nconvert.exe" myProcess.StartInfo.Arguments = "-out jpeg -truecolors 10_fnl.gif" myProcess.StartInfo.CreateNoWindow = True myProcess.StartInfo.WorkingDirectory = "D:\Domains\yourwebsite.com\wwwroot\Xnview\thumbnailer\" myProcess.Start() End Sub </script> <!DOCTYPE html> <html> <body> <h3>EXECUTED</h3> </body> </html>