Skip to content

Instantly share code, notes, and snippets.

@Inventsable
Created July 17, 2019 02:00
Show Gist options
  • Save Inventsable/5c9b87146b3b19eb6bdd5e0aa767490a to your computer and use it in GitHub Desktop.
Save Inventsable/5c9b87146b3b19eb6bdd5e0aa767490a to your computer and use it in GitHub Desktop.
Launch the localhost debugging window for any Adobe CEP panel without knowing the app, port number, or using CSInterface
function launchLocalHost() {
// Find the path to the .debug file within your current extension
const debug = window.cep.fs.readFile(
`${decodeURI(window.__adobe_cep__.getSystemPath("extension")).replace(
/file\:\/{1,}/,
""
)}/.debug`
);
// Match the line indicating the active application's port number
const port = new RegExp(
`\\<Host\\sName\\=\\"${
JSON.parse(window.__adobe_cep__.getHostEnvironment()).appName
}\\"\\sPort\\=\\"(\\d*)`
);
// Launch this port number in a new Chrome window
cep.util.openURLInDefaultBrowser(
`http://localhost:${debug.data.match(port)[1]}`
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment