Hi
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.
instdict.json
instdict.ps1
logo.png
param(
[string]$DICT_LANGUAGE,
[string]$PLAIN_TEXT
)
$PLAIN_TEXT = $PLAIN_TEXT.Trim()
try{
$json = Invoke-RestMethod -Uri "https://api.dictionaryapi.dev/api/v1/entries/$DICT_LANGUAGE/$PLAIN_TEXT" | convertto-json -depth 100
$match = [regex]::match($json,'definition": "(.+)",')
$fulltext = ""
$counter = 1
while($match.Success){
$fulltext += "$counter. """ + $match.Groups[1].Value + """`n"
$match = $match.NextMatch()
$counter = $counter + 1
}
$fulltext = $fulltext.Substring(0,$fulltext.Length - 1)
Write-Output $fulltext
}
catch{
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"
}
}]
}
]
}