Topics - Nod5 [ switch to compact view ]

Pages: prev1 [2] 3 4 5 6 7 ... 22next
6
This post is to test if we can embed a short MP4 animation inline in DC forum posts. Here goes:

edit:

We can attach the .mp4 to the bottom of the post, but it then downloads rather than shows in the browser.

Attempts at embedding that did not work with an .mp4 file attachment
[attachment=1]
[attachthumb=1]
[attachimg=1]

Also not working: embed animation from imgur server
[img]https://i.imgur.com/0SE2wDQ.mp4[/img]

 test

7
The FARR command dosearch lets an alias perform a new search and display the results. We can use search folder modifier keys and trigger long search patterns from a short alias. Great! But dosearch has no options to adjust the results line for each search match.

This request is an enhanced dosearch command, call it dosearchformatresults, that lets us format the search result lines.

One idea for the syntax is to put result formatting at the end after a frontslash and keyword, like for the FARR window options and /icon=... instructions. Like this
dosearchformatresults <regular dosearch syntax here> /result=<result formatting here>

The result formatting part would have the syntax we can use for results in aliases plus special variables related to each search match file. Example:
%filename% | showfilehtml %filepath%
In this example FARR would perform a dosearch for .html files and then for each match show a result line that when triggered shows the .html files inside FARR, rather than open it in the default .html application (external browser).

Probably some more complex escaping of characters and other ways to avoid weird conflicts/loops would be needed (recursive dosearchformatresults might cause weird issues for example  :D).

We can already achieve something like what I'm requesting via external scripts and appcapresults. But that is complex and FARR could probably do it quicker. The external workflow steps goes like this:
- FARR alias that passes a regex match from the typed string in FARR to an external script via dolaunch and appcapresult
dolaunch appcapresult C:\externalscript.exe $$2
- external script that searches some folder for e.g. .html files with filenames that match the passed string(s)
- for each match prepare a result line with the showfilehtml command
- result lines are passed back to FARR via stdout when the script exits
- FARR's appcapresult reads the results and displays them
- the user selects a result and presses Enter to view the HTML page inside FARR
In this external workflow FARR starts an external process and waits for it to finish for each typed character, which I've seen can cause some slowdowns.

This animation illustrates how it looks.
https://i.imgur.com/6LEOsFM.mp4

The .html files in the illustration are derived from the TLDR project - a neat collection of short usage examples for CLI commands in Linux/Windows -  that I've converted from Markdown (previous post related to that).

8
Background: I'm using FARR to show HTML files generated by Pandoc from Markdown source files with CSS similar to that of GitHub.

I ran into some CSS issues which got me searching for details on the browser engine/mode used by FARR. The forum posts I find on that are quite old and I'm not sure if they reflect the current state of FARR. Thus questions:

1. What browser engine/mode (not sure what the correct term is here) does FARR by default use on a fresh install of Windows 10 with latest updates? Edit: answered in edits below.
2. Are some FARR settings available to adjust what browser is used or some details on how it is used?

The help page https://www.donationcoder.com/Software/Mouser/findrun/help/html_view_mode.htm says
Html view mode is currently rendered using the IE activex dll as an embedded web browser.  This means that it will use the version of the Internet Explorer engine installed on the user's pc, and can support displaying anything that can be displayed in a normal browser.
It is not so clear if that means IE11.

One of my CSS issues was that FARR did not show the background color of inline code blocks in the HTML I tested with.

How it looks in Firefox/Chrome/Edge
firefox chrome edge.png

How it looks in FARR
FARR.png

I tracked this down to the CSS using the color function RGBA which IE seems to not support
edit: My mistake. The correct RBGA() compatibility page says IE9+ is supported, IE6-8 is not.

Adding this line to the HTML
<head>
<meta http-equiv="x-ua-compatible" content="IE=edge" />
makes FARR show the code element background color just like in the external browsers.
I found that on https://stackoverflow.com/a/22964400 , with much more background on https://stackoverflow.com/a/6771584 .

So, workaround achieved, I suppose. But I'm unsure what other changes in how FARR renders HTML that line causes. Does it make FARR use Edge? Or adjust the IE1 version/mode used? I hope for feedback from mouser or others on this topic.

edit: Answering myself. We can check browser document mode by adding this line to the HTML document, which shows a popup when FARR renders it
<script>alert(document.documentMode);</script>
Findings: Before adding the "<meta ..." line my FARR used document mode IE7. After adding the line FARR uses IE11.

That explains why the CSS RGBA() function, which required IE9+, only worked after adding the line. Note also that the "IE=edge" part does not mean that the browser Edge is used, it instead means that the newest available Internet Explorer document mode will be used. Which is IE11 on a fully updated Windows 10 PC today.


To reproduce my exact steps do this:

- download cmd.md from the tldr project GitHub.
- download this style.css that mimics GitHub's looks.
- download Pandoc
- run this to output the file cmd.html
pandoc -c style.css -s cmd.md --self-contained -o cmd.html

- edit cmd.html and remove these lines (otherwise FARR will freeze and not show the HTML)
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->

- create a FARR alias with this as result
showfilehtml C:\path\to\cmd.html

- trigger the alias and notice that the code elements lack background color
- edit cmd.html again and add this below the <head> line
<meta http-equiv="x-ua-compatible" content="IE=edge" />
- trigger the alias again - now the background color should show.

BTW I'm reworking some of my FARR stuff which explains my many recent FARR posts. Bear with me mouser :)


9
Minor UI request: option to hide the alias name string that in large icon mode shows under each non-filepath result.
alias_name.png
FARR display options lets us uncheck the "Location" report column. But that hides both alias name strings and filepaths. I'd prefer to only hide the alias name strings and keep filepaths visible.
options.png

Edit:

Alternatively, an option to customize what that smaller line of text contains, through commands in results lines. Perhaps something similar to the "/hint=..." syntax?

I've also noticed that if we use appcapresults to generate a list of results then in some cases FARR shows the string "alias" on this smaller line also in cases where it would have shown e.g. "showfilehtml C:\file.html" if the result was defined in the regular FARR alias settings.

10
In FindAndRunRobot version 2.234.01 mouser added a useful alias command called appcapresults

appcapresults runs an external program, waits for it to output to stdout and then display that output (if correctly formatted) as FARR results lines.

This post shows examples on how to use it together with AutoHotkey to generate a results list in FARR.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; example AutoHotkey script for use with FARR appcapresults
  4.  
  5. ; prepare a results list
  6. ; each line adheres to FARR's format for lines in alias results
  7. ; note: must have a blank line at the end, otherwise the last text line won't show in FARR
  8. Results =
  9. (
  10. Notepad | C:\Windows\System32\notepad.exe
  11. Paint | C:\Windows\System32\mspaint.exe
  12.  
  13. )
  14. ; use fileappend with * to write the list to stdout
  15. FileAppend, % Results , *

1. Save the above script as C:\folder\example.ahk and compile to C:\folder\example.exe

2. Next create a FARR alias
alias name: appcapresults example
alias regex: ^appcap$
alias results:
example | appcapresults C:\folder\example.exe

After that you can type "appcap" in FARR and press enter to get something like this

appcap.png

To make the alias trigger automatically, without Enter, you can change the alias to
example | dolaunch appcapresults C:\folder\example.exe

That's the basics. But this opens up the possibility of complex, conditional aliases. Some possibilities:
- Have the script present different results lists based on the current day/time
- Pass the %lasthwnd% parameter from FARR to the script and have script present different results depending on what window was active before FARR. For example we could make the alias "help" and have it show our own customized help hints based on what application is active. Related earlier post.
- Another example is to have the script search Everything via its SDK and display the search results in FARR, in effect creating an alternative Everything plugin for FARR. This works, though I don't have the code cleaned up enough to post it yet.


edit:

More complex example: alias results conditional on the active window

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ; complex example conditional AutoHotkey script for use with FARR appcapresults
  4.  
  5. ; window id for active window as parameter sent from FARR
  6. LastHwnd := A_Args[1]
  7.  
  8. ; if active window is Firefox
  9. If LastHwnd and WinExist("ahk_exe Firefox.exe ahk_id " LastHwnd)
  10. {
  11.   Results =
  12.   (LTrim
  13.   Google | https://www.google.com/
  14.   Wiki | https://en.wikipedia.org/
  15.  
  16.   )
  17. }
  18.  
  19. ; if active window is MS Paint
  20. If LastHwnd and WinExist("ahk_exe mspaint.exe ahk_id " LastHwnd)
  21. {
  22.   Results =
  23.   (LTrim
  24.   // use FARR sendkeys command to send action shortcuts to MS Paint
  25.   Resize | sendkeys ^w
  26.   Crop selection | sendkeys ^(+x)
  27.  
  28.   )
  29.  
  30. }
  31.  
  32. ; use fileappend with * to write the list to stdout
  33. FileAppend, % Results , *

1. Save the above script as C:\folder\example2.ahk and compile to C:\folder\example2.exe

2. Next create/edit a FARR alias
alias name: appcapresults example2
alias regex: ^appcap$
alias results:
example | appcapresults C:\folder\example2.exe %lasthwnd%

Type "appcap" and press enter over MS Paint and Firefox to get different results

mspaint2.png

firefox.png

GIF of sending the action shortcuts to MS Paint from FARR
https://i.imgur.com/0SE2wDQ.mp4

edit2: improved complex example

Pages: prev1 [2] 3 4 5 6 7 ... 22next
Go to full version