Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Get Values from INI file
Topic Summary:
Created On: 11/14/2005 08:34 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 11/14/2005 08:34 AM
User is offline View Users Profile Print this message

Author Icon
Noel
AutoMate Coach(200+)

Posts: 237
Joined: 04/01/2005

Here is a task that will get a value from an INI file in the following format given the Filename, Section and Key.

[Section1]
Key1=Value1
Key2=Value2
[Section2]
Key1=Value3
Key3=Value4

This script could probably be more efficient or more straight-forward, but I think it gets the job done.

To be clear, this will only get an INI file value. It is not written to set an INI value. Hopefully, this will help anyone that needs to get this type of task done until the AutoMate folks add this to the next version.


Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Thanks,

Noel Scheaffer

Edited: 11/14/2005 at 11:07 AM by Noel
 11/14/2005 08:37 AM
User is offline View Users Profile Print this message

Author Icon
Noel
AutoMate Coach(200+)

Posts: 237
Joined: 04/01/2005

Here is a task that calls my previous posted task to show how it could be used.


Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Thanks,

Noel Scheaffer
 02/01/2016 01:44 AM
User is offline View Users Profile Print this message

Author Icon
WalterTiggeloven
n00b (>6 posts)

Posts: 4
Joined: 01/31/2016

I know this is a thread from the dinosaur era. EVen though I think the topic can be a present-day topic. For me it is. And yes, I'm a Automate newbie.

So I am looking for a way to read from INI (not to write).

Copy-paste? Copy of course is possible, but to paste? Where? I Cannot find a place to do that. Searching for a solution I figured out that paste the code into a .aml file should be possible and than importing that file....

I read this (about importing aml).

But than.... first a warning that this task was created in a prvious version of AutoMate, followed by a question if I would like to convert. In think so... (as if I have a choice): yes. Then an error: file not found (the one I was importing).

Another attempt - which seemed logic to me: File >> Tools >> Expression Builder >> Paste (Ctrl-V) >> Button Insert. Unfortunately: Nothing happens.

So big question: how to import (or paste) this code. And more important: how to read from INI-file?



Edited: 02/01/2016 at 02:28 AM by WalterTiggeloven
 02/02/2016 12:32 AM
User is offline View Users Profile Print this message

Author Icon
WalterTiggeloven
n00b (>6 posts)

Posts: 4
Joined: 01/31/2016

Well ... I start wondering whether this forum is still active.  But there always is a chance that new users end upo with the same question as I had. So ... after a good evening puzzling I came up with this piece of working code (AutoMate 10.4.2.1).

Attached is an import file.



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


ReadINI v1.0.aml
ReadINI v1.0.aml  (4 KB)



Edited: 02/02/2016 at 06:38 AM by AutoMate Discussion Moderator
 02/02/2016 10:18 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Walter,

I apologize for the delay and thank you for posting your code.

-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 02/03/2016 10:45 PM
User is offline View Users Profile Print this message

Author Icon
WalterTiggeloven
n00b (>6 posts)

Posts: 4
Joined: 01/31/2016

No problem Ricardo.

Another lesson I'd like to share with future visitors of this thread: reading from the INI is very slow.  When you need to do this only once or twice, this might not be a problem at all. If you like to do this more often - like I do - you might find out it is too slow.

So I changed my method. I was storing and reading config details using that INI. Now I tried to do the same using XML. That really speed things up.

Just an advize......

Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1761 guests browsing this forum, which makes a total of 1761 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog