Spaces in ini file

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Spaces in ini file

Post by kpassaur » Mon Dec 05, 2016 11:08 pm

I am looking to create a little setup program for naming files. In it there are separate sections where a user could specify a file name separator, you know a dash, underscore or a space. So, they want a space, I write a space to the ini file. I open the ini file and the space is there. No problem, however when you read the ini file it disregards it.

Is there some sort of setting that makes it read a space? Yes I could do a work around but it doesn't make sense to have to. You know if you really want a space put in to "##" etc in the setup. And then write the ## and when it is read convert it back to a space. Or I see the space in the setup, I write the ## and then translate it into a space.

Personally I would go with an underscore or a dash, but, you can't always get what you want and it this case I have to have a space.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Spaces in ini file

Post by Marcus Tettmar » Tue Dec 06, 2016 10:18 am

INI files can have spaces. Maybe I'm missing something but spaces are no problem for me:
inithing.PNG
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Re: Spaces in ini file

Post by kpassaur » Tue Dec 06, 2016 10:36 am

That is not what I am talking about I am talking about this:

SEP1=

After this there is a space in the ini file. You can't see it, as it is a space. It is there when you open the ini file and put your cursor there so it is being written to. However, it is not being read. It's easy enough to have a # and then replace that when it is read with a space but it would be nice to skip that if it is a option.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Spaces in ini file

Post by Marcus Tettmar » Tue Dec 06, 2016 4:22 pm

It works if you use quotes:

[settings]
step1=" "

Use quotes when you write out and then those spaces between won't be ignored:
https://en.wikipedia.org/wiki/INI_file#Quoted_values
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Re: Spaces in ini file

Post by kpassaur » Tue Dec 06, 2016 5:13 pm

Thanks, I put in use a # sign and then when it was read I replaced it with a space. The issue was that eventually I will press the button to remove trailing spaces and then it would be broken. Thanks for the proper fix.

Regards

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Spaces in ini file

Post by CyberCitizen » Wed Dec 07, 2016 8:11 am

Let>Step1={""}
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts