Sign in to follow this  
Followers 0
thebman

Recursive Read File

3 posts in this topic

I need to read a file {attached} and find every instance of the string :

Key Name: HKEY_CURRENT_USER\Printers\Connections\,,

I then need to copy the next part of the text after this:

USMMMQQQ01,USMMMPP-40H4ULCRC-1

I guess in to a 2d array with the , as the delimiter

USMMMQQQ01

USMMMPP-40H4ULCRC-1

Basically what this is is an export of a registry key for my network printer connections, there can be multiple printers. I need to find each entry for each printer and break it down so I have the print server name and the printer name for each printer.

p.txt

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I need to read a file {attached} and find every instance of the string :

Key Name: HKEY_CURRENT_USER\Printers\Connections\,,

I then need to copy the next part of the text after this:

USMMMQQQ01,USMMMPP-40H4ULCRC-1

I guess in to a 2d array with the , as the delimiter

USMMMQQQ01

USMMMPP-40H4ULCRC-1

Basically what this is is an export of a registry key for my network printer connections, there can be multiple printers. I need to find each entry for each printer and break it down so I have the print server name and the printer name for each printer.

I fail to see what the question is here. Did you make any attempt before posting here since you "guess" you could do something?

Edit:

The obvious choice here for most that use it would be RegEx.

#include <array.au3>
$s_text = FileRead("p.txt")
$a_sre = StringRegExp($s_text, "HKEY_CURRENT_USER\\Printers\\Connections\\,,(.+?),(.+?)(?:\z|\r)", 3)
_ArrayDisplay($a_sre)
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Read the helpFile for RegRead() , RegWrite and related...


Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

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