Page 1 of 1

Use "%FILE" "%TEMPFILE" in the parameters

Posted: Wed Mar 12, 2025 3:31 pm
by AZJIO
I didn't understand how to get the file path before. For saved ones it is "%FILE", for unsaved ones it is "%TEMPFILE". If I use "%FILE", the tool does not work with unsaved file. I've now figured out that you have to use both parameters at the same time: "%FILE" "%TEMPFILE".

This code polls all parameters until it finds an existing path.

Code: Select all

Count = CountProgramParameters()
For i = 1 To Count
	tmp$ = ProgramParameter()
	If Asc(tmp$) And FileSize(tmp$) > 3 And Left(GetExtensionPart(tmp$), 2) = "pb"
		Break
	EndIf
Next
I've added this code to all my tools: "alignment_of_comments", CodeLocalization, CommentLocalization, FindAllReferences (Linux), Include_Helper, no_comment, pb2html, Tidy. Who has encountered the problem, then update these plugins.

Re: Use "%FILE" "%TEMPFILE" in the parameters

Posted: Wed Mar 12, 2025 4:48 pm
by Little John
AZJIO wrote: Wed Mar 12, 2025 3:31 pm For saved ones it is "%FILE", for unsaved ones it is "%TEMPFILE".
This is not quite correct. %TEMPFILE can be used for both saved and unsaved files.

Re: Use "%FILE" "%TEMPFILE" in the parameters

Posted: Fri Mar 14, 2025 2:53 pm
by AZJIO
Little John wrote: Wed Mar 12, 2025 4:48 pm This is not quite correct. %TEMPFILE can be used for both saved and unsaved files.
This behavior may have changed recently, but I've previously seen tools that use 2 parameters. Take a look at SearchForUnusedIdentifiers.pb

Code: Select all

; Tool Settings:
; - Arguments: "%FILE" "%TEMPFILE"
pbOptimizer