Page 2 of 3

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 19:59
by Shmuel

Latest post of the previous page:

Try this macro with the next nightly build of Far Manager:

Code: Select all

Macro {
  description="Set 28592 codepage"; filemask="*.4gl";
  area="Editor"; key="Read"; flags="DisableOutput";
  action=function()
    Keys("ShiftF8 CtrlAltF 2 8 5 9 2")
    if Menu.GetValue():match("^28592") then Keys("Enter")
    else Keys("Esc")
    end
  end;
}

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 20:06
by 2useven10
Да так логичнее выгдядит.
Ещё бы заменить key="Read" на event="Load" ...

It looks more appropriate.
One suggestion to change key="Read" to event="Load" ...

Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 20:09
by John Doe
2useven10 wrote:Да так логичнее выгдядит.
Ещё логичнее будет с использованием Menu.Select
2useven10 wrote:event="Load" ...
Это да

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 20:11
by t-rex
No russian in the english forum please!

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 22:07
by Shmuel
2useven10 wrote:It looks more appropriate.
One suggestion to change key="Read" to event="Load" ...
"key" versus "event" -- didn't want to add new fields.
"read" versus "load" -- the terminology used in plugins API was chosen.
But these issues are still open to discussion.

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 23:09
by John Doe
Shmuel wrote:"key" versus "event" -- didn't want to add new fields.
http://forum.farmanager.com/viewtopic.p ... 41#p100541

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 23:21
by Shmuel
John Doe
We can move to the Russian part of the forum and open a new topic dedicated to the latest changes in macro specification.

Re: Setting static Codepage in Far3-Editor.

Posted: Tue 05 Feb, 2013 23:23
by John Doe

Re: Setting static Codepage in Far3-Editor.

Posted: Wed 06 Feb, 2013 09:01
by Far3c
Thank you very much. It's working fine. (Molodci, sposibo.)
I want write yet:
I starting Far3 from another task so:
"\Far3\Far.exe /e blabla.4gl"
Therefore solutions with:
area="Editor"; key="Read";
is OK, but solutions with:
area="Shell"; key="F4";
is not usable.
Thank you once more.

Re: Setting static Codepage in Far3-Editor.

Posted: Thu 07 Feb, 2013 19:37
by Shmuel
Far3c
Starting from the next nightly build your macro should look like this:

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl";
  group="EditorEvent"; name="Read";
  action=function()
    far.MacroPost([[
      Keys("ShiftF8 CtrlAltF 2 8 5 9 2")
      if Menu.GetValue():match("^28592") then Keys("Enter")
      else Keys("Esc")
      end
      ]],"KMFLAGS_DISABLEOUTPUT")
  end;
}

Re: Setting static Codepage in Far3-Editor.

Posted: Fri 08 Feb, 2013 10:22
by Far3c
Thank you, Shmuel. I have next 3 questions.
I would like in this macro:
- add *.4gl and *.err files
- change setting:
F9 -> Options -> Editor settings -> Tab size=3
I would like run command "chcp 850" with start FarManager.

Re: Setting static Codepage in Far3-Editor.

Posted: Fri 08 Feb, 2013 11:55
by 2useven10
Shmuel
Trunk version doesn't work.
Sorry CP select favorite mode was activated (Ctrl-H).

Re: Setting static Codepage in Far3-Editor.

Posted: Fri 08 Feb, 2013 12:42
by 2useven10
Far3c
Try this version...

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl,*.err";
  group="EditorEvent"; name="Read";
  action=function()
    far.MacroPost([[
      local cp, favorite = 28592, false
      Keys("ShiftAltF9 Down Down Down Down 3 Enter")
      Keys("ShiftF8")
      if Object.ItemCount < 20 then Keys("CtrlH"); favorite = true end
      if Menu.Select(cp,1) > 0 then Keys("Enter") else Keys("Esc") end
      if favorite then Keys("ShiftF8 CtrlH Esc") end
    ]],"KMFLAGS_DISABLEOUTPUT")
  end;
}
It should work with favorite mode too...

Re: Setting static Codepage in Far3-Editor.

Posted: Fri 08 Feb, 2013 14:50
by Shmuel
Far3c wrote:Thank you, Shmuel. I have next 3 questions.
I would like in this macro:
- add *.4gl and *.err files
- change setting:
F9 -> Options -> Editor settings -> Tab size=3
I would like run command "chcp 850" with start FarManager.

Code: Select all

Event {
  description="Set 28592 codepage"; filemask="*.4gl,*.err";
  group="EditorEvent"; name="Read";
  action=function()
    editor.SetParam(nil, "ESPT_CODEPAGE", 28592)
    editor.SetParam(nil, "ESPT_TABSIZE", 3)
  end;
}
 
With regards to "chcp 850" I currently have no answer (lack of time).

Re: Setting static Codepage in Far3-Editor.

Posted: Fri 08 Feb, 2013 15:48
by Far3c
Super. In Editor and Viewer Settings is selection default Codepage now.
Thank you.

Re: Setting static Codepage in Far3-Editor.

Posted: Mon 11 Feb, 2013 10:46
by Shmuel
Far3c
If you're still using this macro, update it for the next nightly build to the version below:

Code: Select all

Event {
  description="Set 28592 codepage";
  group="EditorEvent"; filemask="*.4gl,*.err";
  action=function(Id,Event,Param)
    if Event == far.Flags.EE_READ then
      editor.SetParam(nil, "ESPT_CODEPAGE", 28592)
      editor.SetParam(nil, "ESPT_TABSIZE", 3)
    end
  end;
}