Copy link to clipboard
Copied
Hello everyone,
I wrote this code that works and does what I've wanted.
I want to add try/catch or something similar to that which will to execute a code and finish it within 10 seconds, if it isn't finished in 10 seconds then do something else.
Any help please?
Instead of alert() in bridge talk use your photoshop function:
function BT() {
nD = new Date(); for(i = 0; i < 10; i++) {
if (i < 10 && new Date() - nD < 10000)
alert(i) else return false;
}
return true
}
(bt = new BridgeTalk()).target = 'photoshop', bt.body = 'BT = ' + BT.toSource()
+ '; BT()', bt.onResult = function(v) {return res = v.body} bt.send(10)
res ? alert('function A') : alert('function B')
Copy link to clipboard
Copied
Instead of alert() in bridge talk use your photoshop function:
function BT() {
nD = new Date(); for(i = 0; i < 10; i++) {
if (i < 10 && new Date() - nD < 10000)
alert(i) else return false;
}
return true
}
(bt = new BridgeTalk()).target = 'photoshop', bt.body = 'BT = ' + BT.toSource()
+ '; BT()', bt.onResult = function(v) {return res = v.body} bt.send(10)
res ? alert('function A') : alert('function B')