Newbie Help Explaining Sample Code

I am trying to write some Powershell code to use as a user defined extension for a small utility called PantherBar. so my approach was to examine one the extensions and tailor it to my needs. I have a historical programing background back in the days of COBOL.

I am a bit perplexed with this code.

What it does is whenever I select any text a taskbar appears on the screen displaying all the extensions applicable to the type of text I have selected for example I have Wikipedia, Evernote, utube.
The example code I have attached is an application called Everything which searches you PC for file. Even though it works perfectly I cannot see it actually calls the program.
Any Help explaining this code would really help me.

Extract Files from Extension file.



        $json = Invoke-RestMethod -Uri "$DICT_LANGUAGE/$PLAIN_TEXT" | convertto-json -depth 100       
        $match = [regex]::match($json,'definition":  "(.+)",')

        $fulltext = ""
        $counter = 1

            $fulltext += "$counter. """ +  $match.Groups[1].Value + """`n"
            $match = $match.NextMatch()
            $counter = $counter + 1

        $fulltext = $fulltext.Substring(0,$fulltext.Length - 1)

        Write-Output $fulltext

        Write-Error "StatusCode:" $_.Exception.Response.StatusCode.value__ 
        Write-Error "StatusDescription:" $_.Exception.Response.StatusDescription
	"name": "Dictionary",
	"identifier": "pantherbar.instdict",
	"icon": "logo.png",
	"actions": [{
			"title": "Dictionary",
			"icon": "logo.png",
			"batchFile": null,
			"keyCombo": null,
			"longRunning" : true,
			"powershellFile": "instdict.ps1",
			"pythonFile": null,
			"regEx": null,
			"requirements": null,
			"url": null,
			"after" : "SHOW_RESULT",
			"options" : [{
				"identifier" : "DICT_LANGUAGE",
				"values" : {
					"Arabic" : "ar",
					"Brazilian Portuguese" : "pt-BR",
					"Chinese" : "zh-CN",
					"English" : "en",
					"French" : "fr",
					"German" : "de",
					"Hindi" : "hi",
					"Italian" : "it",
					"Korean" : "ko",
					"Russian" : "ru",
					"Spanish" : "es",
					"Turkish" : "tr"

No it’s not. That’s the code for Dictionary_v4.

The code for Everything looks quite different.

Just guessing from a quick look as I don’t use PantherBar or Everything. But I suspect Everything sets a PATH to its executable and the everything.ps1 uses that to execute a search against the text highlighted in PantherBar (the variable PLAIN_TEXT).

Content of everything.ps1:


& $ET_PATH -search $PLAIN_TEXT

I note the author of this extension is a well known name in the PowerShell community. I’m not sure if he’s still active on though.

Thanks matt-Bloomfield
Your are absolutely correct i can’t believe I missed that this pandemic must be getting to me.

Thanks again for pointing out my error.

Can I ask a quick question, how does the .json relate to the .ps1 file

Kind Regards

Your best bet to fully understand it is to read through the PantherBar documents, try the tutorial, and contact the developer(s) directly for any support required.