Insert a logo into the active document and Register the logo path in the dialog box!
Hello everyone! The title says it all:
This script written by Kukurykus is 99% of what I'm looking for.
Register the path of a file in the dialog box!
- PTH = "~/Campaign of the last added image";
- (function DLG(v) {
- pth = (dlg = new Window('dialog')).add('edittext', undefined, v), pth.alignment = 'center'
- b1 = (grp = dlg.add('group')).add('button', undefined, 'Locate file').onClick = function() {
- if (((fle = decodeURI(File.openDialog('Select file:'))) != 'null') && fle != v) {
- pth.text = fle, (fle = File($.fileName)).open('r'), jsxFile = fle.read().replace
- (/"(.*)"(?=;)/, '"' + pth.text + '"'), fle.close(), fle.open('w')
- fle.write(jsxFile), fle.close(), dlg.close(), DLG(pth.text)
- }
- }
- b2 = grp.add('button', undefined, 'Import OK').onClick = function() {
- if ((fle = File(pth.text)).exists) open(fle), refresh()
- }
- dlg.show()
- })(PTH)
I need to make a small modification so that it works 100% to meet my needs:
Change the "Open" option to Insert in the current file
It is essential that you always keep track of the path of the last image inserted in the dialog box!
Whenever I run this script, always insert the last recorded image into the current document.
Thank you!
