Copy link to clipboard
Copied
File name ="115%11.ai"
If open file , occur error: The specified file could not be opened because it could not be found.
Why? How can open this file?
Copy link to clipboard
Copied
Mac or Windows?
Are you trying to open the file from plugin code, a script or just opening it in Illustrator?
The percent sign in the name is probably something to do with it.
Copy link to clipboard
Copied
I open by Code, in Window.
"115%1.ai","115%9.ai" open ok.
"115%11.ai","115%10.ai",... open error.
Copy link to clipboard
Copied
The files "115%11.ai","115%10.ai" do definately exist?
Can you show your code?
Copy link to clipboard
Copied
Dim strFileName="D:\Data\115%11.ai""
oApp.Open(strFileName)
Copy link to clipboard
Copied
Is that your real code? You have two double quotes at the end of the first line.
Copy link to clipboard
Copied
your 5 posts in before you hint at the fact that you are working with VB and not JS.
not so confident in VB.
but in JS the open function requires a file object not a path.
also the \ can act as an escape char.
example of what this would look like in Javascript:
var myFile = File("D:/Data/115%11.ai");
app.open(myFile);
Copy link to clipboard
Copied
so having a play with VB.
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Open("C:\Users\tristan\Desktop\~~~Crap\11511.ai")
this works no problem
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Open("C:\Users\tristan\Desktop\~~~Crap\115%11.ai")
this fails!
VB is not my thing and I don't do much with it so it has me a little ![]()
edit:
if I open the file and run this:
Set appRef = CreateObject("Illustrator.Application")
msgbox appRef.ActiveDocument.Name
I get a message box with:
115%11.ai
so I guess that means I will be no help at all unless you decide to use javascript.
maybe if CarlosCanto‌ is online he may shed some light, as he plays with VBscript and he is a fountain of knowledge...![]()
Copy link to clipboard
Copied
The reason is that in VB strings you can use % followed by a hex number to represent a single character with that ascii code, e.g. %61 = a
When you have 115%1.ai or 115%9.ai you have a single digit and a period after the %, as this is not a valid hex number, AI just treats the % as a % character. When you have 115%10.ai or 115%11.ai, you have a valid hex number after the %, so %10 gets replaced by the character with ascii code 16 (hex 10) and %11 gets replaced by the character with ascii code 17 (hex 11).
So how do you work around this? One way is to replace the % character with %25 as % has the acsii hex code 25, so 115%2510.ai will be converted to 115%10.ai.
Copy link to clipboard
Copied
‌nice explanation
interisting that when displayed in a message box it showed the 115%11.ai as is.
i Really need to improve my vb.
im starting to play with vb.net so that should help.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more