Skip to main content
junats
Participant
February 8, 2025
Question

Scripting Problem: %20 Makes My Script Not Read My Links / Files

  • February 8, 2025
  • 2 replies
  • 190 views

I've been having this error of the script not being able to find the file (shortcut files or .lnk) even though it is at the location. I know that the %20 mean to be spaces but I don't know how to deal with it (See warning). 


Here's my script!

// Function to open Chrome profiles (Windows only)
function openChromeProfile(profileFileName, url) {
    // Get the script's location
    var scriptFolder = new File($.fileName).parent;

    // Construct the full path to the .lnk file
    var profilePath = new File(scriptFolder.fsName + "/assets/" + profileFileName);

    // Debug: Show expected full path
    alert("Script is running from: " + scriptFolder.fsName);
    alert("Checking file path: " + profilePath.fsName);

    if (profilePath.exists) {
        alert("Found: " + profilePath.fsName);
        system.callSystem('cmd /c start "" "' + profilePath.fsName + '"');
    } else {
        alert("❌ ERROR: Profile shortcut not found!\nExpected at: " + profilePath.fsName +
            "\n\nPossible fixes:\n- Ensure the .lnk file exists inside the assets folder.\n" +
            "- Check for spaces or hidden file extensions in the filename.\n" +
            "- Try manually opening this path in File Explorer.");
    }
}

 
If someone could help, thanks in advance!

2 replies

Participant
February 10, 2025

Your script may be failing due to spaces in the file path. Try wrapping profilePath.fsName in double quotes:

system.callSystem('cmd /c start "" "' + profilePath.fsName + '"');

If that doesn’t work, replace spaces with (caret) for Windows CMD compatibility or check if the .lnk file has a hidden extension.

Dan Ebberts
Community Expert
Community Expert
February 8, 2025

I think File() expects the path to be URI encoded, so the %20 for spaces should be fine, but are you sure the path is correct? I don't see a /assets/ folder in AE's Support Files folder..