Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error open file: The specified file could not be opened because it could not be found?

Enthusiast ,
Sep 06, 2015 Sep 06, 2015

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?

TOPICS
SDK
5.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Advocate ,
Sep 07, 2015 Sep 07, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 07, 2015 Sep 07, 2015

I open by Code, in Window.

"115%1.ai","115%9.ai" open ok.

"115%11.ai","115%10.ai",... open error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 07, 2015 Sep 07, 2015

The files "115%11.ai","115%10.ai" do definately exist?

Can you show your code?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 09, 2015 Sep 09, 2015

Dim strFileName="D:\Data\115%11.ai""

oApp.Open(strFileName)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 10, 2015 Sep 10, 2015

Is that your real code? You have two double quotes at the end of the first line.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 10, 2015 Sep 10, 2015

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 10, 2015 Sep 10, 2015

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 11, 2015 Sep 11, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 11, 2015 Sep 11, 2015
LATEST

‌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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines