[RQ] Shortcut searchstring menu

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 17
Joined: Sat Dec 08, 2007 12:45 pm
Contact:

[RQ] Shortcut searchstring menu

Post by guest »

I would like to have a Shortcut menu to a defined text in a document.

Example, lets say you are playing Final Fantasy VII and are using an FAQ from Gamefaqs. All these Faqs have a Table of Contents with chapers that you find by using CTRL+F (find) and then then the number beside the chapername to Jump to the right section in the document without scrolling and searching.
Example faq: http://www.gamefaqs.com/console/psx/file/197341/33519

I would like to add my favorite search strings to a menu or a hotkey so I can easily jump to my favorite section in a text file.

The search string info for every text file could be maybe be stored in a .ini file so it remembers the shortcuts for every separate .txt file.

It would be better if all this info could be stored as a drop down menu so you can see all the different search string names that you have added. (like the CTRL+D function in totalcommander) something like this:


Image

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

1. Scripts plugin - required version 2.7 or higher:

a. Create new script {AkelPad}\AkelFiles\Plugs\Scripts\SearchArg.js with next contents:

Code: Select all

/// Search argument text

var AkelPad = new ActiveXObject("AkelPad.document");

var FR_DOWN       =0x00000001  //Find down
var FR_MATCHCASE  =0x00000004  //Search is case-sensitive
var FR_UP         =0x00100000  //Find up
var FR_BEGINNING  =0x00200000  //Search from beginning (usage: FR_DOWN|FR_BEGINNING)
var FR_SELECTION  =0x00400000  //Search in selection (usage: FR_DOWN|FR_SELECTION)
var FR_ESCAPESEQ  =0x00800000  //Search with escape sequences
var FR_ALLFILES   =0x01000000  //Search in all openned MDI documents (usage: FR_DOWN|FR_BEGINNING|FR_ALLFILES)

var hMainWnd=AkelPad.GetMainWnd();
var hEditWnd=AkelPad.GetEditWnd();
var oFunction=AkelPad.SystemFunction();
var pScriptName=WScript.ScriptName;

if (AkelPad.TextFind(hEditWnd, WScript.Arguments(0), FR_DOWN) == -1)
{
  if (AkelPad.TextFind(hEditWnd, WScript.Arguments(0), FR_DOWN|FR_BEGINNING) == -1)
    AkelPad.MessageBox(hMainWnd, GetLangString(0), pScriptName, 48 /*MB_ICONEXCLAMATION*/);
}

//Functions
function GetLangString(nStringID)
{
  var nLangID;

  nLangID=oFunction.Call("kernel32::GetUserDefaultLangID");
  nLangID=nLangID & 0x3ff; //PRIMARYLANGID

  if (nLangID == 0x19) //LANG_RUSSIAN
  {
    if (nStringID == 0)
      return "Строка \"" + WScript.Arguments(0) + "\" не найдена.";
  }
  else
  {
    if (nStringID == 0)
      return "String \"" + WScript.Arguments(0) + "\" didn't found.";
  }
  return "";
}
2. ContextMenu plugin:

a. Call ContextMenu::Main.
b. Choose instead "ContextMenu:Show menu" - "Main menu".
c. Press "Enable".
d. Modify menu:

Code: Select all

"&Shortcuts" Index(-1)
{
  -"Chocobo Farm" Call("Scripts::Main", 1, "SearchArg.js", "Fw00A", 0)
  -"Weapons List" Call("Scripts::Main", 1, "SearchArg.js", "Fw042", 0)
  SEPARATOR
  -"Configure" Call("ContextMenu::Main", 1, 1)
}
e. Press "OK".

3. Now you can choose "Shortcuts -> Weapons List" in main menu to find "Fw042".

Offline
Posts: 3217
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

EN:
As I have understood, the guest wants that was functional allowing to add in the menu the reference to the found text automatically, i.e. on certain command. It would be valid interestingly!

But, IMHO, it is better to expand functional a LineBoard plug-in, i.e. that it would be possible to keep a set of tabs of a file (it is admissible in a separate file with special extantion) and also to have the interface (dialogue of names of tabs) for jump to the necessary tab.


RU:
Как я понял, Гость хочет чтобы был функционал позволяющий добавлять в меню ссылку на найденный текст автоматически, т.е. по определённой команде. Это действительно было бы интересно!

Но, IMHO, лучше расширить функционал LineBoard плагина, т.е. чтобы можно было бы сохранять набор вкладок файла (допустим в отдельный файл со спец. расширением), а также иметь интерфейс (диалог имён вкладок) для перехода к нужной вкладке.
Post Reply