Can't find the bug in my code . Unexpected Catch token (Line 98 Char 13)?

function AppendResults(text) {
            txtResults.value = txtResults.value + "\r\n" + text;
        }

        function InitialiseActivityRuntime() {
            if (activityRuntime == null) {
                try {
                    if (window.external.IsActivityRuntime)
                    {
                        activityRuntime = window.external;//new ActiveXObject("Datamine.MineTrust.Client.ActivityRuntime");
                        AppendResults("InitialiseActivityRuntime succeeded.");
                    }
                    else
                        AppendResults("InitialiseActivityRuntime failed (window.external).");
                }
                catch (e) {
                    AppendResults("InitialiseActivityRuntime failed: " + e.message);
                }
                AppendResults("");
            }
        }

        function onLoad() {
            InitialiseActivityRuntime();
        }

        function RunActivity() {
            try {
	// Retrieve input paths
	var filetoCopyddmmyyyyPath = activityRuntime.GetInputPath("filetoCopyddmmyyyy");


	// Retrieve output paths
	var copiedFileddmmyyyyPath = activityRuntime.GetOutputPath("copiedFileddmmyyyy");


	// Retrieve control values
	var sourceFoldernnnnnnnValue = activityRuntime.GetControlValue("sourceFoldernnnnnnn");
	var targetfoldernnnnnnnValue = activityRuntime.GetControlValue("targetfoldernnnnnnn");
	var fileNamennnnnnnValue = activityRuntime.GetControlValue("fileNamennnnnnn");
	
	//Create a new FileSystemObject

var fso = new ActiveXObject("Scripting.FileSystemObject");

 //If the folder doesnt exist create it.

   if(!fso.FolderExists(targetFoldernnnnnnnValue))

       fso.CreateFolder(targetFoldernnnnnnnValue);

        //Get the number of files to copy and create a loop counter.

          var inputCount = activityRuntime.GetMultipleInputCount("filetoCopynnnnnnn");

          alert(inputCount);

          var index;

       //Copy all files in the source folder to the target location.

          for (index = 1; index <= inputCount; index++)

         {

var fileToCopy = activityRuntime.GetMultipleInputPath("filetoCopynnnnnnn", index);

//For the destination file path, look for the last instance of a double backslash

//in the fileToCopy variable, then replace everything after it with the output file name

var fileToCopyName = fileToCopy.substr(fileToCopy.lastIndexOf("\\") + 1);

//Call FSO's CopyFile method

fso.CopyFile(filetoCopynnnnnnnPath, copiedFilennnnnnnPath);

 

//Send a short report to the Activity Manager window

AppendResults("File has been copied.");



                AppendResults("Success.");
            }
            catch (e) {
                AppendResults("RunActivity failed: " + e.message);
            }
            AppendResults("");
        }
        
        function ActivityComplete() {
            try {
                activityRuntime.EndActivity(true, ""); // this will cause the activity and this script to end
            }
            catch (e) {
                AppendResults("ActivityComplete failed: " + e.message);
            }
            AppendResults("");
        }

        function ActivityFailed() {
            try {
                activityRuntime.EndActivity(false, ""); // this will cause the activity and this script to end
            }
            catch (e) {
                AppendResults("ActivityFailed failed: " + e.message);
            }
            AppendResults("");
        }
    </script>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Welcome to the forum.

First of all, your code formatting is a mess. It is really hard (for me, you, anyone) to properly understand messy code. Learn to format as you go. If you’re working locally, install things like linters and prettier. Learn some of the standards of JS formatting. It will be painful at first but will save so much time and headache in the future.

Again, it’s really hard to tell what is going on in your code or where this error is referring to, but this catch here? What try is it catching?

//Send a short report to the Activity Manager window

AppendResults("File has been copied.");



                AppendResults("Success.");
            }
            catch (e) {
                AppendResults("RunActivity failed: " + e.message);
            }
            AppendResults("");
        }