Hi macaroniKazoo,
thanks... 
to Busta,
I'm glad I could help, I have also learn a lot trying to help solving it... 
I have worked a bit more on the script, and it can now select more than one vertex, and spit out the output, I found some info regarding the command "stringArrayRemove", in the helpfile... -->
http://localhost:4444/Maya5.0/en\_US/Comman...ove.script.html
Example given in the help file...
string $list[] = { a, b, c, d, e, f, g };
string $items[] = { a, c, e, g };
string $diff[] = stringArrayRemove($items, $list);
// Result : { b, d, f } //
I have tested it, and if you put it in the script folder, and then type "getConnectedVertices" on the command line... it should write the result in the script editor...
I had some problems since string arrays don't like the "+" sign, and gives an error, but I solved it by making a seperate string, which got the extracted value from the current position from the array...
I also used the filterExpand command you wrote... to get them seperated, because if more than one vertex was selected, it would store it in the array as [a:z], instead of [a],[b]...[z]...
it also works if there are some edges selected aswell, however the test print "print($sVertex)" won't work if a edge also is selected along with the vertices...
I have put some "---" for seperation of the selected vertex and the connected result, since I haven't figured it out, how to get the result on one lline, e.g. like...
vertex nr. 1 is connected with: Vertex 2, Vertex 3, Vertex 4 etc.
instead of the result it gives at the moment...
--------------------------------------------------//
vertex nr. 1 is connected with:
Vertex 2
Vertex 3
Vertex 4
etc.
//--------------------------------------------------
but here it comes... hope you can use it... 
regards
Strarup
///--------------------- start of script ------------------------------------------//
global proc getConnectedVertices()
{
int $j;
string $sVertexList[]=ls -sl
; //the selected items/objects
string $sVertex[] = filterExpand -ex true -sm 31 $sVertexList
; //"seperates" the arraylist, to get individual vertices...
//print($sVertex); //just for test purpose, to see if it works... 
string $curVertex;
for( $j = 0; $j < size ($sVertex); $j++ ) //if there is more than one selected vertex...
{
int $i;
string $edge[] = `polyListComponentConversion -toEdge $sVertex[$j]`; //edges to the selected vertex...
print("--------------------------------------------------// n");
$curVertex = $sVertex[$j]; //current selected vertex...
print($curVertex+" is connected with: n");
print(" -------------------------------------------------- n");
for( $i = 0; $i < size ($edge); $i++ ) //to get vertices of the edges to the selected vertex...
{
//the vertices which are "connected" to the selected vertex...
string $verts[]=`polyListComponentConversion -toVertex $edge[$i]`;
string $list[] = `filterExpand -ex true -sm 31 $verts`; //connected vertex list...
string $items[] = {$curVertex};
//remove the selected vertex from the connected vertex list...
string $result[] = stringArrayRemove($items, $list);
print($result);
}
print("//-------------------------------------------------- n");
}
}
///--------------------- end of script ------------------------------------------//[/b]