Unfortunately not, but if anyone wants to try it I come with even more advanced vesion for Windows...
EXTENDED VARIATION of SECOND METHOD:
Code: Select all
#target photoshop
function rw(v1, v2, v3) {v2.open(v1), v1 < 'w' ? v3 = v2.read() : v2.write(v3), v2.close(); return v3}
function SYS(v) {return File(Folder.desktop + '/sys.' + v)} sys = SYS('txt'), bat = SYS('bat')
$.level = 0; try{aDfN = activeDocument.fullName, close(SaveOptions.DONOTSAVECHANGES)}
catch(err) {aDfN = ''}; lN = File(Folder.desktop + '/fullName.txt')
if (!/A[\w ]+s$/.test(decodeURI(fNp = (fN = File($.fileName)).parent))) {
rw('w', pth = File(Folder.desktop + '/Path.txt'), '')
if (aDfN) {try{rw('w', lN, aDfN)} catch(err) {}}
File(fNp + '/Sender.bat').execute()
while(!rw('r', pth)) refresh();
(jsx = File(eval(rw('r', pth).replace(/\n/, '')
.replace(/\\/g, '//')) + '/' + fN.name)), pth.remove()
File((ap = app.path) + '/Presets/' + fN.name.slice(0, -4)).createAlias(jsx)
sys.open('w'), sys.write('ping 127.0.0.1 -n 2 > nul\r\start "' +
ap.fsName + '\\photoshop.exe" ' + '"' + jsx.fsName + '"\r\exit')
sys.close(), File('~/Desktop/sys.txt').rename('sys.bat')
File(String(sys).replace(/txt/, 'bat')).execute(), photoshop.quit()
}
else {
dlg.btnPnl = (dlg = new Window('dialog', 'TEST', undefined)).add('panel')
dlg.btnPnl.levels = dlg.btnPnl.add('button', undefined,'Levels', {name: 'ok'})
dlg.btnPnl.cancel = dlg.btnPnl.add('button', undefined, 'Cancel', {name: 'cancel'})
dlg.btnPnl.levels.onClick = function() {
bat.remove(), dlg.close(); try{
executeAction(charIDToTypeID('Lvls'), undefined,
DialogModes.ALL), File($.fileName).execute()
}
catch(err) {}
}
if (lN.exists) open(File(rw('r', lN))), refresh(), lN.remove()
if (documents.length) dlg.show() else alert('Open document!')
}
Now your Photoshop is going to be reopened, and last active Document there was opened will open once again while script start its main part, display dialog box. If there was no document opened before Photoshop was closed you recieve appriopate information. The adventage of this method is that you don't have manually reopen Photoshop to add and activate script on File / Scripts! As you see in the script, it uses another batch file (this time created by .jsx script) which opens Photoshop with Command Line (Prompt), what btw is another way to run scripts in Ps without security warning. Take into consideration that this script uses also:
Code: Select all
set "dat=%HOMEPATH%\desktop"
cd %dat%
for /f "skip=2 tokens=2*" %%a in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"') do @set "docs=%%b"
xcopy "%dat%\c.jsx" "%docs%\Adobe Scripts" /f /y
echo "%docs%\Adobe Scripts" > %dat%\Path.txt