Tutorial Plugin : 6 - Liste des commandes

De Wiki Francophone de Maxthon
Aller à la navigation Aller à la recherche

This is a short summary of all important Maxthon commands and links. You can [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark] this page so you can quickly lookup this information.

Voici un court sommaire des commandes et des liens utiles de Maxthon.
Vous pouvez ajouter cette page à vos [javascript:external.addFavorite(document.location.href="http://www.ldfa.net/wiki/index.php/Tutorial_Plugin_:_6_-_Liste_des_commandes), 'Liste rapide des plugins de Maxthon')" > Favoris].
Ainsi vous accéderez plus rapidement à ces informations.

Commandes de Maxthon

Security_id: For Toolbar Plugins: %max_security_id For Sidebar Plugins: Inside max.src, called max_security_id

Security_id :

  • Pour les plugins de barre d'outils : %max_security_id
  • Pour les plugins de barre latérale : Inside max.src, called max_security_id


These are the Maxthon DHTML commands:

Voici les commandes DHTML de Maxthon :


  1. readFile( security_id, plugin_name, file_name) Read a text file.
    Lire un fichier texte.
    var text = external.readFile(%max_security_id,
    "Test plugin","export.txt")
  2. writeFile( security_id, plugin_name, file_name, content ) Write a text file.
    Ecrire un fichier texte.
    external.writeFile(%max_security_id,
    "Test plugin","export.txt", "Some Data.")
  3. m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value) Read an ini-file.
    Lire un fichier 'ini'.
    path = external.m2_readIni(%max_security_id,
    "testplugin","settings.ini","general","save","0")
  4. m2_writeIni( security_id , plugin_name , file_name , section_name , key , value ) Write an ini-file.
    Ecrire dans un fichier 'ini'.
    external.m2_writeIni(%max_security_id,
    "testplugin","settings.ini","general","save","true")
  5. tab_count Total number of tabs.
    Nombre total d'onglets.
    var total_tab = external.tab_count
  6. activate_tab( security_id , index ) Activate tab number (starting from zero).
    Active le numéro d'un onglet (commence à zéro).
    external.activate_tab(%max_security_id,2)
  7. close_tab( security_id , index ) Close a tab.
    Fermer un onglet.
    external.close_tab(%max_security_id,2)
  8. get_tab( security_id , index ) Get the webpage object from tab 'index'.
    Obtenir de l'index des onglets la variable objet d'une page web.
    var doc = external.get_tab(%max_security_id,2).document
  9. cur_sel The number of the active tab.
    Le numéro de l'onglet actif.
    var cur_tab = external.cur_sel
  10. m2_plugin_folder( security_id , plugin_name ) The local path of the plugin.
    Le chemin local du plugin.
    var folder = external.m2_plugin_folder(%max_security_id,
    "ViewSource!")
  11. m2_run_cmd( security_id , id ) Call a Maxthon command with the specified ID.
    Appeler une commande de Maxthon avec une ID spécifiée.
    external.m2_run_cmd(%max_security_id,32772)
    This will open a blank page.
    Ceci ouvre une page blanche.
  12. m2_callerName( security_id, plugin_name) This function tells Maxthon the call is made from a Plugin.
    Cette fonction indique à Maxthon l'appel effectué à partir d'un plugin.
    external.m2_callerName(%max_security_id,"ViewSource!")
  13. max_showConfig( security_id, plugin_name) Show the plugin's config dialog.
    Montre la boite de dialogue de configuration du plugin.
    external.max_showConfig(%max_security_id,"ViewSource!")
  14. max_activex(security_id, prog_id) Create an ActiveX object.
    Crée un objet ActiveX.
    var tempwin = window.open()
    var XML=tempwin.external.max_activex(%max_security_id,
    "Microsoft.XMLDOM")
    tempwin.close()
  15. max_modelessDialog( security_id , url , option , attr , window ) Open a modelessDialog.
    Ouvre Une boite de dialogue modèle.
    external.max_modelessDialog(%max_security_id,
    'example.htm',window, 
    'status:no;help:no;resizable:yes;scroll:yes;',window)
  16. max_language_id The user's current selected language.
    Le langage en cours sélectionné par l'utiisateur.
    var language=external.max_language_id
  17. max_actSideBarItem( plugin_name ) This function will activate the sidebar plugin named as 'plugin_name'.
    Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
    external.max_actSideBarItem("Calculator++&quot)
  18. addFavorite( url , title ) , addFavorite( url ) Add the 'url' into favorites.
    Ajoute l'adresse URL aux favoris.
    external.addFavorite( "http://www.google.com" )
    external.addFavorite( "http://www.google.com",
    "This is google")
  19. addProxy (name, address, speed, is_web_proxy) Call Maxthon's add proxy dialog.
    Appelle la boite de dialogue "Ajouter un proxy".
    external.addProxy("My proxy",
    "192.168.1.0:8080",1,0)
  20. addFilter( address ) , addFilter( address, is_pop_filter ) Call Maxthon's add filter dialog.
    Appelle la boite de dialogue "Ajouter un filtre".
    external.addFilter("http://www.yahoo.com/ad*")
    external.addFilter("http://www.yahoo.com/img/*", 0)
  21. m2_search_text( security_id ) This property will return the text in Maxthon's search bar.
    Cette propriété renverra le texte dans la barre de recherche de Maxthon.
    var text = external.m2_search_text(%max_security_id)

In a sidebar plugin you can implement a script function called max_callback(status).
Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).

  1. Created: URL = FILENAME?maxcmd=init
  2. Activated = max_callback('sidebar_activate')
  3. Deactivated = max_callback('sidebar_deactivate')
  4. Tab Change=max_callback('sidebar_tab_change')
  5. Unload=max_callback('sidebar_unload')

Useful Links

Liens utiles

These links are useful for reference and if you start learning HTML and Javascript.
Ces liens sont utiles pour des références si vous débutez dans l'apprentisage des langages HTML et Javascript.

Useful Maxthon Links :
Liens très utiles pour utiliser Maxthon :

< Partie 5 : Exemples | Sommaire Plugin