I want Replace default to be "Entire Document"

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
ordba
Posts: 6
Joined: Fri Aug 27, 2004 12:44 pm

I want Replace default to be "Entire Document"

Post by ordba »

When I perform a replace I want the default to be ReplaceAll. Is this still programmable. There use to be a line in my old ZEUS.INI file which is ReplaceAll=1. This doesn't seem to work anymore.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

When I perform a replace I want the default to be ReplaceAll. Is this still programmable.
The answer is yes and no :?

If you use the Edit, Replace menu or the toolbar button to run the replace then the anser is no :(

If you initialte the replace using a keyboard shortcut then the answer is yes :)

The reason is the toolbar and menu are hard coded to run the ReplaceWordCurrent keyboard function, while keyboard can be re-configured.

The following macro script implements the required replace feature:

Code: Select all

function key_macro()
  screen_update_disable()

  -- save the current search options (this is optional)
  search_options_save()

  -- set the scope required
  SearchScopeEntire()

  -- control of other search settings (these are optional)
  SearchCaseSet()
  SearchCaseReset()
  SearchWordSet()
  SearchWordReset()
  SearchRegexpSet()
  SearchRegexpReset()

  -- display the replace dialog
  ReplaceDialog()

  -- restore the origianl search options (this is optional)
  search_options_restore()

  screen_update_enable()
  screen_update()
end

key_macro() -- run the macro
Save this macro to the replace.lua file in the zScript directory located off the Zeus install directory.

To test the macro use the Macros, Execute Script menu and type replace. The macro will execute and display the replace dialog with the scope set to "Enite document".

The final step is to bind the macro to the keybaord. For more imformation on how this is done see the Binding a Macro to the Keyboard example.
Guest

Post by Guest »

:D Thanks Jussi,

I even added the lines below to make the macro totally intrinsic.

local fs_search_text = "@" -- where @ = a very crazy ascii char
local fs_replace_text = " " -- replace with a blank
set_find_text(fs_search_text)
set_replace_text(fs_replace_text)

By reading all your macros in zScript I'm starting to get the hang
of it.

Take care, Steve
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

By reading all your macros in zScript I'm starting to get the hang
of it.
With a bit of practice I am sure you will soon get the hang of the Zeus macros :)

And if you run into a problem, just post a message to the forum and I will be happy to offer my assistance.

Cheers Jussi
Post Reply