Copy link to clipboard
Copied
Hello Friends,
I am creating a html extension .
In this extension I am browsing a AI file by clicking a button .
Now I have to open browsed AI file in Illustrator.
I have to open AI TEST.ai file in Illustrator.
so I need the js code for that.
Please assist me.
Regards
Kundan
Add open method. Before return value like below:
if(f){
app.open(f);
return f.fsName;
}
Copy link to clipboard
Copied
There are few way to get local files we can use.
Here is an example using Extendscript's File object:
var csi = new CSInterface();
var es = "(function (){"
+ "var f = File.openDialog('Select ai file...');"
+ "return f.fsName;})();"
csi.evalscript(es, function(cb){
alert(cb);
});
However, You can use Native function. Probably, its better way.
var f = window.cep.fs.showOpenDialog(false, false, "select ai file...", "", ["ai"]);
Copy link to clipboard
Copied
Hello TenA,
By using above code I am able to browse AI file.
But it's not opening in Illustrator .
Please assist.
Regards
Kundan
Copy link to clipboard
Copied
You can add open method in Extendscript part like below:
var csi = new CSInterface();
var es = "(function (){"
+ "var f = File.openDialog('Select ai file...');"
+ "return f.fsName;"
+ "app.open(f)})();"
csi.evalscript(es, function(cb){
alert(cb);
});
Copy link to clipboard
Copied
Thank you TenA,
It's working but It's only browse the path not opening in illustrator.
After click on button , I am able to browse the AI path but browsed AI file is not opening in Illustrator.
Please assist.
Regards
Kundan
Copy link to clipboard
Copied
Can you show me your codes?
Copy link to clipboard
Copied
Please find the atteched code.
main.js
Illustrator.jsx
index.html
Please find file structure of extension.
Please find the above detail.
Regards
Kundan
Copy link to clipboard
Copied
In JSX, where you do the application controlling, you have to write all the pertinent code for things Illustrator does - so you need to have an app.open(file) command to open the returned File from the open dialog.
Copy link to clipboard
Copied
Add open method. Before return value like below:
if(f){
app.open(f);
return f.fsName;
}
Copy link to clipboard
Copied
Thanks for reply.
Yes now it's works.
Regards
Kundan
Copy link to clipboard
Copied
Hi kundan,
I need this script pls send me xxxxxxxxx.
Copy link to clipboard
Copied
Hi,
I removed your Email address.
Please note that do not write private info in public. You can use Private Message in this forum.
Copy link to clipboard
Copied
Thanks for reply TenA,
I am trying .
Regards
Kundan