topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday October 5, 2024, 5:28 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Open alias/group in notepad++  (Read 6495 times)

ahkscript

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Open alias/group in notepad++
« on: January 08, 2019, 10:57 PM »
Is it possible to open alias/group in notepad++, do some editing and have FARR apply changes to alias/group?
Don't mind paying someone to create an addon to do that.
Thanks

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #1 on: January 08, 2019, 10:59 PM »
Can you elaborate a little bit on what you have in mind, and the motivation for not wanting to use the built-in FARR alias editing facility in options?

ahkscript

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #2 on: January 08, 2019, 11:04 PM »
Notepad++, which I'm sure you are familiar with, is a great text editor. I can achieve a lot and quickly using it.
I'm thinking maybe an addon that would copy a group content to a temporary file, wait for it to be changed and apply changes in FARR.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #3 on: January 09, 2019, 06:27 AM »
FWIW I'm (slowly) working on an AutoHotkey helper program to replace FARR's built in methods for editing aliases. Not ready for release yet, but working good so far in my test use. Some features:
- jump directly to alias editor window from FARR
- search/filter box with live filter (very useful when you have a lot of aliases)
- some syntax syggestions in the alias edit window
- shortcuts to create regex aliases
- FARR is still usable while the alias editor window is open

Here are some notes on where and in what format FARR stores its aliases, based on me testing things and from looking around in FARR files. Mouser can correct me if I'm wrong on anything here.

FARR stores aliases in .alias XML files. The default user file is
<MyDocuments> \DonationCoder\FindAndRunRobot\AliasGroups\MyCustom\myaliases.alias

other FARR settings including the list of disabled (uncheckboxed) aliases are in
C:\Users\ <user> \Documents\DonationCoder\FindAndRunRobot\FindAndRunRobot.ini

You can edit the .alias file in Notepad++ or any code editor, but it is a bit clunky to manually edit .xml. However if you for example want to change a folder path in a lot of aliases then it'll be easy to do a find/replace all in this file.

Some more notes on interacting with the above files:
- Edits to myaliases.alias have effect when FARR starts.
- Important: FARR adds to .alias the line "<Disabled>true</Disabled>" for each disabled alias. But that only mirrors the authoritative setting in FindAndRunRobot.ini > [Settings] > DisabledAliasStrings
- Edits to FindAndRunRobot.ini only stick when made while FARR is not running, otherwise FARR restores the old values from working memory.

To prevent FARR from restoring old values use this method to change aliases from an external script:
1 exit FARR  (commandline -exit)
2 edit .alias / .ini and save
3 run FARR   (commandline -hide)

Edit: it is easy to mess up with direct edits to the .alias / .ini files so make sure you create backups of them first.
« Last Edit: January 09, 2019, 06:47 AM by Nod5 »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #4 on: January 09, 2019, 09:46 AM »

You can already send FARR a windows message (or is it commandline call) to make it RELOAD its aliases after you have changed them outside of FARR.. Let me look it up and tell you how to do that.. That prevents the need to exit and restart FARR.
So the process would simply be to edit the alias outside FARR, and then send FARR them command to make it reload its aliases from file.  No problem.

As far as the original request -- it would helpful to hear more about what is important to you to understand what is important and not-important.  For example, it would be trivial to add a button to the options tab where you are looking at an alias to tell it to open an alias in an external text editor.. but I can't tell if being able to quickly edit an alias file without having to go to options alias page is the part that's important to you..



ps. Very cool, Nod5! Looking forward to seeing an alpha.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #5 on: January 09, 2019, 01:28 PM »
You can already send FARR a windows message (or is it commandline call) to make it RELOAD its aliases after you have changed them outside of FARR.. Let me look it up and tell you how to do that..
I'm all ears about windows messages for FARR, haven't tried that method. Before using the exit-edit-start method I tried editing while FARR was running and then sending the special string "goareload" to the FARR editbox , but that it isn't silent (FARR must be open and FARR also forces the special string agroups afterwards) and cannot handle enabling/disabling aliases I think since FARR will override the disabled/enabled change from memory or .ini. Previous thread on that here https://www.donation...ex.php?topic=45199.0

ahkscript

  • Supporting Member
  • Joined in 2013
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #6 on: January 09, 2019, 10:17 PM »
I can't tell if being able to quickly edit an alias file without having to go to options alias page is the part that's important to you..
That's exactly what I'm looking for, a way to edit aliases in Notepad++ without having to go through options windows. And of course have FARR reload edited aliases.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: Open alias/group in notepad++
« Reply #7 on: January 10, 2019, 06:05 AM »
a way to edit aliases in Notepad++ without having to go through options windows. And of course have FARR reload edited aliases.

Ok, here is a quick fix to do that.
Caveats: you'll have to manually edit xml formatted data and you won't be able to disable/enable aliases but can edit/create/remove.

Step 1: create a new FARR alias
Change "<username>" and perhaps the path strings below to match those on your PC

name: notepad++ myaliases edit
regex: ^ali$
results:
edit aliases in notepad++ | C:\Program Files (x86)\Notepad++\notepad++.exe C:\Users\<username>\Documents\DonationCoder\FindAndRunRobot\AliasGroups\MyCustom\myaliases.alias

Step 2: make this AutoHotkey helper script start with Windows
When control+s is pressed in Notepad++ and the active file is named myaliases.alias and FindAndRunRobot.exe is running then the script exits FARR, performs the save and then restarts FARR. In all other cases control+s should perform a normal save in Notepad++.

Code: Autohotkey [Select]
  1. SetWorkingDir %A_ScriptDir%
  2.  
  3. ;farr_notepad++_helper_script
  4.  
  5. farr := "C:\Program Files (x86)\FindAndRunRobot\FindAndRunRobot.exe"
  6.  
  7. #IfWinActive ahk_exe notepad++.exe
  8. ^s::
  9. if RegExMatch(win_title, "^.+\myaliases.alias - Notepad..$") and processExist("FindAndRunRobot.exe")
  10. {
  11.   ;if notepad++ active tab is myaliases.alias and FARR process exist
  12.   ;then exit FARR, apply save, silently restart FARR
  13.   RunWait "%farr%" -exit
  14.   send ^s
  15.   sleep 100
  16.   Run "%farr%" -hide
  17. }
  18. else
  19.   send ^s
  20. return
  21.  
  22. ;function: check if process exists
  23. processExist(process_name){
  24.   process,exist,% process_name
  25.   return errorLevel ;PID or 0
  26. }

Create a backup of your myaliases.alias before testing this in case you or the script unexpectedly mess upp the file.

An alternative to the always running hotkey script in step 2 is to create another FARR alias that only temporarily runs a script with the same exit save restart steps if the last active window before FARR was notepad++ with myaliases.alias open. In this alternative you'd instead of control+s use a FARR alias to initiate the save.
« Last Edit: January 10, 2019, 06:11 AM by Nod5 »