Wikipedia talk:AutoWikiBrowser/Custom Modules

Use an external file for Custom modules

edit

Hi, since in the Custom Modules syntax isn't highlighted and there is no support for code completion, I can upload a file (development with a IDE) in C # as custom module, or must I create a plugin.--B3t (talk) 09:31, 17 March 2010 (UTC)Reply

You can write your custom module anywhere you like. After that you just paste it in to custom module box in AWB. Personally I use Notepad++. Rjwilmsi 09:38, 17 March 2010 (UTC)Reply
Is what I do, I thought there was a hidden way to speed up the process. Thanks.--B3t (talk) 10:00, 17 March 2010 (UTC)Reply
PS (digression): I'm using since a long time Notepad++ but not for these things because I do not understand how to add libraries (e.g. WikiFunctions.dll), so I use SharpDevelop.--B3t (talk) 10:17, 17 March 2010 (UTC)Reply

Log

edit

Exist a logger for Custom Modules? Because I need it.--B3t (talk) 20:03, 17 March 2010 (UTC)Reply

There's no core logging facility but you can easily write to your own text file. I can provide a code snippet if needed. Rjwilmsi 12:43, 18 March 2010 (UTC)Reply
Ok, thanks.--B3t (talk) 13:57, 18 March 2010 (UTC)Reply
I do it.--B3t (talk) 22:53, 18 March 2010 (UTC)Reply

Functions in CustomModule

edit
  1. (Start form here) Is there a bool function that indicates whether a template is contained in the page?
  2. If so, is there a way to access certain parameters of the template?
  3. Is there a bool function that indicates whether a link is a redirect?
--B3t (talk) 01:39, 19 March 2010 (UTC)Reply

(1) No, but if you call Tools function public static string RenameTemplate(string articletext, string templatename, string newtemplatename) you can work it out by whether the return is the same as the input.

(2) Yes, call Tools function public static string GetTemplateParameterValue(string template, string parameter)

(3) For the link call Variables.MainForm.TheSession.Editor.SynchronousEditor.Clone().Open(title) to get the link target page, then call Tools function public static bool IsRedirect(string text) passing in the article text. Rjwilmsi 08:29, 19 March 2010 (UTC)Reply


Hi, thank you for responding. So

(1) The workaround that can tell me it's good

string testoArticolo = Tools.RenameTemplate(ArticleText, nomeTemplate, nomeTemplate);
Skip = Tools.CaseInsensitiveStringCompare(testoArticolo, ArticleText) ? false : true;

but I prefer to use a regular expression that seems to work

Regex header = new Regex(@"\{\{" + nomeTemplate + @"\s*\|", RegexOptions.IgnoreCase);
Skip = header.Match(ArticleText).Success ? false : true;

(2) There is a bug in some calls. I talk here

(3) Don't work.--B3t (talk) 01:05, 20 March 2010 (UTC)Reply

You'll have to elabourate on "don't work". What doesn't? Reedy 14:35, 22 March 2010 (UTC)Reply
Also, don't use
Skip = header.Match(ArticleText).Success ? false : true;
Use:
Skip = !header.IsMatch(ArticleText);
Reedy 14:36, 22 March 2010 (UTC)Reply

@Reedy: No work, but it could work better. Thanks for the last annotation. (I saw here)--B3t (talk) 16:44, 23 March 2010 (UTC)Reply

Including external file?

edit

Is there a way to have code in an external file and include it into custom modules? This would allow code which is used by several modules to be maintained in only one place, or to store frequently reused code in a convenient place. 159.83.4.153 (talk) 23:13, 22 April 2010 (UTC)Reply

No, not that I'm aware of. For that level of complexity perhaps you should be making a plugin. Rjwilmsi 14:00, 23 April 2010 (UTC)Reply

HideMore documentation and/or source

edit

It escapes me how any function could reliably detect and hide quotes. Can someone point me to the documentation and/or source code for HideMore?

As an example of why I think this would be difficult, consider this sentence:

The carpenter said "I hate to tell you this, but the main beam of your house is sagging 5" and it will cost around $5000 to fix it".

Jc3s5h (talk) 16:08, 19 December 2010 (UTC)Reply

Question about Using multiple Custom Modules

edit

I see where its possible to use Using multiple Custom Modules to do things, which is working for me. I cannot figure out though how, or if its even possible to set one to process at the beginning (preferably before the Find and replace and general edits) and set another one to preocess at the end (after the find and replace and general edits). Is that something that can be done and could you point me in the right direction? My assumption is that I have to manually set the order in the module but I wanted to verify that before I went to the trouble. --Kumioko (talk) 22:20, 27 December 2010 (UTC)Reply

I just replaced all my 'find and replace' rules with Custom Module functions and reorder them there. --79.177.243.188 (talk) 03:19, 21 May 2012 (UTC)Reply

Tutorial info?

edit

For those of us who didn't script in our youth, though have done minor minor hacking since, can someone point to a reasonable tutorial site to learn the scripting language. Even somewhere where I could look to test my scripts. Also, can one use %%pagename%% in the module to get {{PAGENAME}}? Thanks. billinghurst sDrewth 22:32, 6 January 2011 (UTC)Reply

Tutorial or Module requests

edit

{{Help me}} Where might one learn how to write these modules in a "for-dummies" type tutorial/academy setting or is there a place where a person can request a module be written for them? Currently on mediawikiwidgets.org I have a category with ~5500 articles that I need to get article creator information for, block the creator with certain settings, and delete the article. Can anyone help me figure out how to script that? Thanks in advance. Technical 13 (talk) 21:44, 29 April 2013 (UTC)Reply

While I unfortunately cannot help you, I expect no one can who doesn't have this page or related pages watchlisted anyway. Thus calling for helpers from all over Wikipedia isn't really useful. Huon (talk) 01:19, 30 April 2013 (UTC)Reply
I expect Wikipedia:AutoWikiBrowser/User_manual#Tools to be of help. Also you may try contacting the coding gurus of Wikipedia like Writ Keeper. (Cant remember anyone else). Also, I expect you to explain me what modules are once you've got them. TheOriginalSoni (talk) 01:43, 30 April 2013 (UTC)Reply

Add template if not already on talk page

edit

I need help for apply Wikipedia:AutoWikiBrowser/Custom Modules#Add template if not already on talk page. How can I made it to insert the template to talk pages that have not already created? Xaris333 (talk) 07:11, 27 December 2013 (UTC)Reply

Which talk pages is {{talk header}} necessary having on?

edit

I perused through the Custom modules subpage and noticed the talk header section. I was wondering, whether talk pages in the draft, user and cat namespaces require having {{talk header}}? Qwerty284651 (talk) 19:50, 8 February 2023 (UTC)Reply

@Qwerty284651: Template:Talk header#Usage might be helpful. GoingBatty (talk) 20:08, 8 February 2023 (UTC)Reply
Mass adding this template to talk pages in any namespace is discouraged. I suggested having a user script do this and someone objected. Appears controversial for some reason. –Novem Linguae (talk) 19:23, 9 February 2023 (UTC)Reply

Refresh Customised "General Fixes"

edit

Hi, it will be nice to have actual version of this code and have a link to SVN with this code. Thanks! A.sav (talk) 12:15, 16 October 2024 (UTC)Reply