AutoHotkey Community

It is currently May 27th, 2012, 12:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: December 2nd, 2005, 10:37 pm 
Offline

Joined: April 26th, 2005, 9:32 pm
Posts: 28
Location: Munich, Germany
I want to read some key from an ini-file. If the key is not present, the variable should be set to the empty string. Right now, I have this code:
Code:
IniRead, ml_Replace, %ConfigFile%, %ml_ScriptName%, ReplaceThis
if ml_Replace = ERROR
  ml_Replace =
This is a little complicated and does not work if the key ReplaceThis this is really ERROR. Is there a better way to do this?

Bernd


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2005, 11:10 pm 
Offline

Joined: December 1st, 2005, 7:04 pm
Posts: 37
Location: Los Angeles, CA
yes, add a default of your own instead of ERROR, for instance:

Code:
IniRead, ml_Replace, %ConfigFile%, %ml_ScriptName%, ReplaceThis, IDIDNOTFINDANYTHING
if ml_Replace = IDIDNOTFINDANYTHING
  ml_Replace =

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2005, 2:51 pm 
Offline

Joined: December 15th, 2004, 10:24 pm
Posts: 303
Location: United States
alternate solution, untested

Code:
IniRead, ml_Replace, %ConfigFile%, %ml_ScriptName%, ReplaceThis, % ""

_________________
1) The Open Source Definition http://www.opensource.org/docs/definition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <<AutoHotkey>>


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, Yahoo [Bot] and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group