Re: Shared folders, WAS Checking for logged on guests
Re: Shared folders, WAS Checking for logged on guests
- Subject: Re: Shared folders, WAS Checking for logged on guests
- From: Graff <email@hidden>
- Date: Fri, 02 Jan 2004 21:40:34 -0500
I think you can do all that with just adding awk to your "do shell
script". The awk tool splits a line up into text fields seperated by
white space. Since you are really only interested in field 5 you can
just add "| awk '{print $5}'" to your "do shell script" command
-----------
set theUserList to {}
set theUsers to do shell script "netstat -na | grep '\\.548' | awk
'{print $5}'"
if theUsers is not "" then
set {oldDelims, text item delimiters} to {text item delimiters, "."}
repeat with theAddress in (every paragraph of theUsers)
set theUserList to theUserList & ((text items 1 thru 4 of theAddress)
as text)
end repeat
set text item delimiters to oldDelims
end if
-----------
- Ken
On Jan 2, 2004, at 4:08 PM, Larry McMunn wrote:
Dave and Craig,
Thanks for your help on finding out about Shared Folder Users.
I have come up with the following:
------------------
set theUsers to do shell script "netstat -na | grep 548"
--with Satimage for regexp
set theUsers to change "^.+LISTEN$\\r?" into "" in theUsers with regexp
set theUsers to change "[[:blank:]]+ESTABLISHED$" into "" in theUsers
with regexp
set theUsers to change "^.+[[:blank:]]([^[:blank:]]+)$" into "\\1" in
theUsers with regexp
set theUsers to change "\\.548$" into "" in theUsers with regexp
if character -1 of theUsers = return then set theUsers to text 1 thru
-2 of theUsers
set theUsers to paragraphs of theUsers
------------------
This shows the addresses of guests on my machine as well as any
volumes that I have mounted, but that's OK, I can simply delete the
ones for the volumes that I may mounted.
--
Happy Automation! :-)
Larry McMunn
President
McMunn Associates, Inc.
Specialists in automated Data Visualization through Apple products
Collingswood, NJ
(856) 858-3440
---------------------------------------------------------------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.