Jump to content

Running EXE with custom links


swish

Recommended Posts

Hey team...

 

Kinda having an issue I cant get...

 

I have a custom link setup to run a template page to run an EXE that was installed in the users files.

 

However it runs the exe and just closes the window...if you run the exe by manually clicking it runs fine...

 

Ideas?

 

<%
       '''''''''''''''''''''''''''''''''''''''''''
       'Variables
       '''''''''''''''''''''''''''''''''''''''''''

       Dim pageTitle As String = "Updater"
       Dim stopGameServer As Boolean = False
       Dim relativePath As String = ""
       Dim command As String = "start PATH-TO-EXE-is-here"
       Dim startMessage As String = "Starting...<br>"
       Dim endMessage As String = "Updater has been started.<br>You can close this window."

       '''''''''''''''''''''''''''''''''''''''''''
       '''''''''''''''''''''''''''''''''''''''''''

       Response.Write("<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">")
       Response.Write("<HTML><TITLE>" & pageTitle & "</TITLE><BODY bgcolor=""#000000""><font face=""Lucida Console"" size=""2"" color=""#FFFFFF"">")

       If TCAdminSDK.Web.Session.IsAuthenticated Then
           Dim serviceid As String = Request.QueryString("serviceid")
           Dim service As New TCAdminSDK.Objects.Service
           service.ServiceID = serviceid
           If service.Find Then

               Dim path As String = System.IO.Path.Combine(service.AutomationFilesPath, relativePath)
               command = command.Replace("%path%", path)

               Response.Write(startMessage)
               Response.Flush()

               If service.UserID = TCAdminSDK.Web.Session.CurrentUser Or TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.Admin Or TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.SubAdmin Then

                   Dim serviceWasRunning As Boolean = False
                   If stopGameServer And service.CurrentStatus = TCAdminSDK.Objects.ServiceStatus.Running Then
                       Response.Write("Stopping the game server...")
                       Response.Flush()

                       service.Stop()
                       serviceWasRunning = True
                   End If

                   Dim serverplugin As TCAdminBase.Plugins.IGenericPlugIn = TCAdminSDK.Remote.InstanceCreator.GetPluginFromServer(service.ServerID, "TCAdminMonitor.StandardPlugins.RemoteServers.ServerUtilities")
                   serverplugin.Execute(New Object() {"ExecuteScript", service.WorkingDirectory, command})

                   If serviceWasRunning Then
                       Response.Write("Starting the game server...")
                       Response.Flush()
                       service.Start()
                   End If
               End If

               Response.Write(endMessage)
               Response.Flush()
           End If
       End If

       Response.Write("</font></BODY></HTML>")
%>

Link to comment
Share on other sites

Main bits to look at are

 

Dim pageTitle As String = "blatext"

Dim stopGameServer As Boolean = True

Dim relativePath As String = ""

Dim command As String = "cd %path%" + vbnewline + "start %path%"

Dim startMessage As String = "blablatext"

Dim endMessage As String = "blablatext."

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 9 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use