Property List Fun

Hello Everyone

I have a text file that contains a list of connections that I want to read in and use as connection property lists:
(serverID:"127.0.0.1,password:"bob")
(serverID:"192.168.0.1,password:"tom")
so that I can do this:
repeat with each machine in theSutLIST
    connect machine
    testStuff
    disconnect
end repeat

Unfortunately, Eggplant/ST will not see each line as a property list:
Runtime Error at line 46: Connection Failed - Unable to connect to Server:(serverID:"127.0.0.1" on port:(null)
Connection failed:
Error resolving host (serverID:"127.0.0.1"

Any Ideas?

Comments

  • Hello Allen:
    todd$ cat /tmp/fileaccess.txt 
    (serverID:"127.0.0.1",password:"bob")
    (serverID:"192.168.0.1",password:"tom")
    

    Ensure the values of a property list are quoted...
    set accessList to "/tmp/fileaccess.txt"
    put file accessList
    

    also use the line option for chunking type in the repeat command
    repeat with each line machine in file accessList
    	put value(machine) is a property list 
    end repeat
    

    and finally leverage the value() command to bring in text from a file and convert it to the SenseTalk value object which the text represents. One thing to keep in mind is that text in a file is not the actual object it represents.
    Wed, 12/19/07 2:50:39 PM	START		Running Untitled.script
    (serverID:"127.0.0.1",password:"bob")
    (serverID:"192.168.0.1",password:"tom")
    
    true
    true
    Wed, 12/19/07 2:50:39 PM	SUCCESS		Execution Time 0:00:00 Untitled.script
    

    Happy Holidays!

    Cheers,
  • Thanks Todd--

    Joy beat you to it. Happy Holidays!

    Allen
  • We need to see more Joy in the forums :)
    Have a great holiday time to all you at MakeMusic, wonderful customers and wonderful people!
Sign In or Register to comment.