Answered
persistent data
What I have been working on has variable fields like email and website address. Is there a way of storing those settings so that next time the script runs there is no need to enter them as they are already present?
What I have been working on has variable fields like email and website address. Is there a way of storing those settings so that next time the script runs there is no need to enter them as they are already present?
what I did find was that my Photoshop prefs file has this string 5d9bdc30-d980-4d66-92b8-3fdb0eb270c5 and not 06704d4d-4e32-4c26-87ab-78d674f1eeab so I tried changing it but no difference
//app.bringToFront();
var settings = new File(app.preferencesFolder + "/{06704d4d-4e32-4c26-87ab-78d674f1eeab}.dat")
var myInstagram; if (myInstagram == undefined) myInstagram = "instagram name here";
try { if (settings.exists) $.evalFile(settings); } catch(e) { alert(e); }
if (!documents.length) {
alert('There are no documents open.', 'No Document');
}
else {
main();
}
function main()
{
try {
// Ask user for input by showing prompt box and save inputted value to variable:
var win = new Window('dialog','Text Input');
win.orientation='column';
win.alignChildren = 'left';
var grp3 = win.add ('group');
var pnl7 = grp3.add('panel',undefined,'Instagram', {borderStyle: 'black'} );
pnl7.orientation='row';
pnl7.alignChildren = 'left';
var instaCB = pnl7.add('checkbox',[10,10,40,20],'On');
var instagramDetail = pnl7.add('edittext', [50,10,220,20], myInstagram);
var grp2 = win.add ('group');
var b1 = win.add("button", undefined, "OK");
b1.preferredSize = [70,20];
b1.onClick = function ()
{
try {
myInstagram = instagramDetail.text;
save_settings();
win.close()
}
catch (e) { alert(e); }
}
var myReturn = win.show();
}
catch (e) { alert(e); }
}
function save_settings()
{
try {
settings.open("w");
settings.writeln("var myInstagram = " + myInstagram.toSource())
settings.close();
}
catch (e) { alert(e); }
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.