Can I use the Attribute Browser to find LinkTypes?

I have an older file that I am trying to optimize. More specifically, I want to clean up “LinkTypes”
image

I have tried to delete them the usual way using the usual way
image

however, they delete temporarily then return. I am thinking there must be some legacy $Edict or $Rule code attached to some of these notes that are causing the unwanted behavior (links returning after they are deleted)

My thought is to use the Attribute browser to find these notes that have been linked by these names, however LinkType is not listed under the Attribute Browser.

I tried changing my query to find notes with $Edict but there were over 1700 notes…no go

Is there another way I can find these notes in question?

Thanks in advance
Tom

Quick and dirty method 1: write an agent that searches for linkTo/linkFrom in $Edict, $Rule, etc.

Quick and dirty method 2: open a copy of the document in BBEdit. Search for linkTo/linkFrom

I suspect that you have actions that are “re-creating” these links.

Hi Tom,

maybe you could reuse my code:

function changeTheLinks_db(theParamters:dictionary) {
	// Parameters passed as a dictionary with type:value pairs
	// changeAllLinks_db("target:/dummy;task:changeType;old:agree;new:disagree");
	// changeAllLinks_db("target:dummy2;task:removeType;dir:out;typ:clarify");
	// changeAllLinks_db("target:all;task:removeType;dir:out;typ:clarify");
	// changeAllLinks_db("target:dummy2;task:addLink;typ:test;tonotes:[dummy;dummy3]");
	
	
	if(!theParameters.empty){
		var:string theMsg    = "Link Management: ";
		var:integer msgCnt   = 0;
		var:string theTarget = theParamters["target"];
		var:string theTask   = theParamters["task"];

		if(theTask == "changeType"){
			theMsg += "Change Type: ";
			var:string theOld = theParamters["old"];
			var:string theNew = theParamters["new"];
			theMsg += "from " + theOld + " to " + theNew + ". "
			if((theOld != "") & (theNew != "")){
				eachLink(aLink, theTarget){
					if(aLink["type"] == theOld){
						msgCnt += 1;
						aLink["type"] = theNew;
					};
				};
			};
			theMsg += "Changed " + msgCnt + " links\n";
		};

		if(theTask == "removeType"){
			var:string theDirection = theParamters["dir"];
			var:string theType      = theParamters["typ"];
			theMsg += "Remove Links of type: " + theType + "\n";

			if(theDirection == "out"){
				eval(theTarget,"unlinkTo(all,'" + theType + "')" );
			} else {
				eval(theTarget,"unlinkFrom(all,'" + theType + "')" );
			};
		};

		if(theTask == "addLink"){
			theMsg += "Add Links: ";
			var:string theType    = theParamters["typ"].trim();
			var:list relatedNotes = theParamters["tonotes"].replace("(\[|\])",""); ;

			if(relatedNotes.count > 0) {
				relatedNotes.each(relatedNote){
					msgCnt += 1;
					createLink(theTarget,relatedNote,theType);
				};
			};
			theMsg += "Added " + msgCnt + " links\n";
		};
		addNewShowEvent_db(theMsg);
	};
};

// remove all links on all children of a note that have a specific type
// removeAllLinks_db("target:/Test/;typ:agree;dir:out;");

function removeAllLinks_db(theParamters:dictionary){
	if(!theParameters.empty){
		var:string theMsg       = "Remove All Links: ";
		var:integer msgCnt      = 0;
		var:string startNode    = theParamters["target"];
		var:string theType      = theParamters["typ"];
		var:string theDirection = theParamters["dir"];
		var:list allMyNotes     = collect(children(startNode),$IDString);
		var:string theParas     = "";

		if(!allMyNotes.empty){
			allMyNotes.each(singleNote){
				theParas = "target:" + $Path(singleNote) + ";task:removeType;dir:" + theDirection + ";typ:" + theType;
				changeTheLinks_db(theParas);
				msgCnt += 1;
			};
		};
		theMsg += "removed " + msgCnt + " links\n";
		addNewShowEvent_db(theMsg);
	};
};