Created
July 17, 2019 02:00
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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