Sign in to follow this  
Followers 0
niftyapple

Potential UDF

5 posts in this topic

Anyone have a UDF for parsing text in YAML layout? Ive written some other stuff in other languages and using YAML files is amazing with the right utilities. Anyone know of anything?

Share this post


Link to post
Share on other sites



Can you provide a few lines of example YAML code and what you want autoit to produce?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

So here is an example yml format. 

saveAllUsers: true
debug:
  path: This/Path/for/Files1
  showexceptions: true
  showlogs: false
Users:
  user1:
    name: John
    Age: 19
  user2:
    name: Jack
    Age: 22
    DOB: 7/1/92

Just a few simple functions is all I was really after. Read and setValue really.

Read could be compatible for something like readYML($file, "Users.user1.name") will return the text string "John".

Setvalue I think is where all the tricks come in. setValYML($file, "Users.user1.name.nick", "Johnboy") && setValYML($file, "Users.user3.name", "Bella") && setValYML($file, "Users.user3.favorites", "Pizza, Toast, Fish") Will endup setting the below code.

saveAllUsers: true
debug:
  path: This/Path/for/Files1
  showexceptions: true
  showlogs: false
Users:
  user1:
    name: John
      nick: JOhnboy
    Age: 19
  user2:
    name: Jack
    Age: 22
    DOB: 7/1/92
  user3:
    name: Bella
    favorites:
      - Pizza
      - Toast
      - Fish

Tabbing will have to be done in spaces only since traditional YML parsers do not accept tabs. Favorites will be returned as a string with commas separating the items because being able to call them individually with Users.user3.favorites-3 = Fish would be amaze.

Seems oddly specific I know, but it would make config files crazy simple since you just call the nodes and it does the rest. Building this into several of my functions would be crazy handy.

I sure hope that wasnt to confusing :P

Share this post


Link to post
Share on other sites

Since YAML is a super-set of JSON, you might find '?do=embed' frameborder='0' data-embedContent>> to be a good starting point for your UDF.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0