// include issue with script file names containing round brackets

Help with writing and running scripts

// include issue with script file names containing round brackets

Postby lm77054 » Fri Oct 14, 2011 8:59 am

A couple of days ago, I renamed my scripts to group them together better. For instance:

x_aarp_(cult_like_sites).js
x_aarp_(john_q_public).js

I found out that UltraEdit doesn't like the parenthesis, or even the square brackets in the file names, despite they are "legal" in Windows file names. I tried to escape the parenthesis with the backslash, and that didn't work.

IMHO this is a bug. The scripts can't handle "legal" file names.
lm77054
Basic User
Basic User
 
Posts: 16
Joined: Sat Feb 26, 2011 12:11 pm

Re: // include issue with script file names containing round brackets

Postby Mofi » Sat Oct 15, 2011 11:00 am

Round brackets are allowed in file names, but should not be used because causing troubles like this or in batch files. Round brackets are used on function calls in all script languages and therefore it is not good to use round brackets for file names.

Square brackets are even more problematic. FAT file system does not allow the usage of [ and ] in file name, see Microsoft support article Overview of FAT, HPFS, and NTFS File Systems.

That's probably the reason why Norton Commander for many, many years displayed directories as [directory name] and why Windows file managers with the GUI like Norton Commander for DOS still use square brackets to emphasize directory names.

Also Microsoft defined [section name] for INI and INF files as there was just FAT and DOS/Windows 16-bit, perhaps also because square brackets were not allowed in file names. Therefore it could not result in a problem when a file name is used as section name in an INI file.

Often round brackets appended to a file name are used as line number information on error and warning messages. The parenthesis are in this case interpreted as delimiter character to separate a string into file name and line number.

Why the include of a script file with round or square brackets is not working must be asked IDM. Perhaps the IDM developers have excluded explicitly them to avoid interpreting a script function within a line comment by mistake as file to include.

I suggest to use 2 or 3 underscores as separator and don't use round and square brackets in file names.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: // include issue with script file names containing round brackets

Postby lm77054 » Tue Oct 18, 2011 9:44 am

Thanks. I made modifications necessary.
lm77054
Basic User
Basic User
 
Posts: 16
Joined: Sat Feb 26, 2011 12:11 pm


Return to Scripts