AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[RQ] Shortcut searchstring menu

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
guest



Joined: 08 Dec 2007
Posts: 17

PostPosted: Tue Jan 08, 2008 10:20 am    Post subject: [RQ] Shortcut searchstring menu Reply with quote

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:


Back to top
View user's profile Send private message Visit poster's website
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5293

PostPosted: Tue Jan 08, 2008 12:17 pm    Post subject: Reply with quote

1. Scripts plugin - required version 2.7 or higher:

a. Create new script {AkelPad}\AkelFiles\Plugs\Scripts\SearchArg.js with next contents:
Code:
/// 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:
"&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".
Back to top
View user's profile Send private message Send e-mail
VladSh



Joined: 29 Nov 2006
Posts: 2602
Location: Киев, Русь

PostPosted: Thu Jan 10, 2008 11:29 am    Post subject: Reply with quote

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 плагина, т.е. чтобы можно было бы сохранять набор вкладок файла (допустим в отдельный файл со спец. расширением), а также иметь интерфейс (диалог имён вкладок) для перехода к нужной вкладке.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group