| View previous topic :: View next topic |
| Author |
Message |
Lemming
Joined: 20 Dec 2005 Posts: 150 Location: Malaysia
|
Posted: Thu May 31, 2007 11:29 am Post subject: [TIP] IniRead Gotcha when using double quotes |
|
|
When using IniRead, double-quote marks will be discarded unless you escape them.
For example, if you have an ini file containing:
| Code: | [IviewLocation]
IviewLocat="C:\Program Files\IrfanView\i_view32.exe"
|
And your script has this corresponding line:
| Code: | IniRead, IviewLocat, Pict saver converter.ini, IviewLocation, IviewLocat
|
The variable IviewLocat will contain the string C:\Program Files\IrfanView\i_view32.exe (without double quotes). This would be fatal if I use it with command line stuff like:
| Code: | | RunWait %comspec% /c %IviewLocat% %filein% /one %ResizeVal% /aspectratio /resample /sharpen=1 /jpgq=92 %fileout% |
Pathnames and filenames that contain spaces must be enclosed in double quotes.
The solution is to use two double-quotes within the ini file, i.e.:
| Code: | [IviewLocation]
IviewLocat=""C:\Program Files\IrfanView\i_view32.exe"" |
Also refer to AHK Escape Sequences:
http://www.autohotkey.com/docs/commands/_EscapeChar.htm
Last edited by Lemming on Tue Jun 05, 2007 5:19 am; edited 1 time in total |
|
| Back to top |
|
 |
Helpy Guest
|
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 150 Location: Malaysia
|
Posted: Tue Jun 05, 2007 5:20 am Post subject: |
|
|
whoops, you're right. IniRead it is. Changes made.
[Moderator's note: Also added [TIP] flag to make it stand out and ease searches.] |
|
| Back to top |
|
 |
|