[RÉSOLU] Presse papier

Vous voulez de l'aide ? Postez ici :)
Post Reply
yah
Posts: 23
Joined: 25 May 2010, 23:13

[RÉSOLU] Presse papier

Post by yah »

J'ai une variable dans le presse papier qui est assez longue et avec des // des ;

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
    <settings program="actionaz" version="3.1.1" scriptVersion="1.0.0" os="Windows"/>
    <actions>
        <action name="ActionVariable" version="1.0.0"/>
        <action name="ActionMessageBox" version="1.0.0"/>
        <action name="ActionWriteClipboard" version="1.0.0"/>
        <action name="ActionReadClipboard" version="1.0.0"/>
        <action name="ActionCode" version="1.0.0"/>
    </actions>
    <parameters/>
    <script pauseBefore="0" pauseAfter="0">
        <action name="ActionVariable">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <exception id="32" action="0" line=""/>
            <parameter name="variable">
                <subParameter name="value" code="0">Nom</subParameter>
            </parameter>
            <parameter name="value">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">string</subParameter>
            </parameter>
        </action>
        <action name="ActionWriteClipboard">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="value">
                <subParameter name="value" code="0">javascript:CreateUnit(212207012,'TESTOK','w0KGgoAAAANSUhEUgAAACoAAAAMEAQAAADurzu4AAAAAmJLR0T//xSrMc0AAAAJcEhZcwAAAEgAAABIAEbJaz4AAAHlSURBVDjLzZQ/S8NQFMWvGm0LVlTa6FDopkgmFRc/gKvg4KCgoODk5kdwFEEQ7OAi6CCIe2kHnRXcBDso7kJLpNV00J/DNTRN88/NBw9uOCfnnPdyc0X++cpkIDHZsvzkP7wsIgMDyfkjIwm4Y2PJBP3Gc3Od54WFvx0i8aEhm4WLC2g2oV6H01MYHu7mjI9DowHBopDLwfk52HbzGbTO5eL0i9MQ5+0xOTsDgJUV2N3V+uiom3N4yO8SEZma6g4MpRLAfglge1uZJydx+nHehYLHB2xbCUNDMDqqda3WwYvF10nwBp2Z8Qet1RQ1Td0AT09x+nHevhtttZSQTkMmA+DYnSBXewAbG96gvRofH4oaBgwOat1qhenD52eo93RIz8L1tZLX1mB9XeuvL8VmZ+HhAfr7o4N+f7sY9PW5Gvk8ROuHYwEmplm9B2i34fYW3t6gXlesUoGlJa2jgurNmHfQe6OmCeVysH44JhIxhcAw2scANzfecP4lIpJKQaEAlgXw+Njp0YkJt0dTKX8vGwY4jqsvIpLPu1+iF/OFq1Z1PMzPw+ammqyu+gdv9I0eHCi6taXb+9cH68dhASaLi9qHjgMvL7CzE8wLDqr/eDYLl5dq+v6us9Gdo+H6yxYk8RYR+QHaiEALmvVbpwAAAABJRU5ErkJggg==');</subParameter>
            </parameter>
        </action>
        <action name="ActionReadClipboard">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="variable">
                <subParameter name="value" code="0">Nom</subParameter>
            </parameter>
        </action>
        <action name="ActionCode">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="code">
                <subParameter name="value" code="1">var expr = new RegExp("^javascript:CreateUnit\\(\\d+,'(\\w+)','\\w+'\\);$");
var result = expr.exec(Nom);

if(!result || result.length == 0)
   Console.print("No result");
else
   Nom = result[1];
   Console.print("Found: " + result[1]);</subParameter>
            </parameter>
        </action>
        <action name="ActionMessageBox">
            <exception id="0" action="0" line=""/>
            <exception id="1" action="0" line=""/>
            <exception id="2" action="1" line=""/>
            <parameter name="windowIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="message">
                <subParameter name="value" code="1">Nom</subParameter>
            </parameter>
            <parameter name="title">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="ifYes">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">do_nothing</subParameter>
            </parameter>
            <parameter name="customIcon">
                <subParameter name="value" code="0"></subParameter>
            </parameter>
            <parameter name="icon">
                <subParameter name="value" code="0">none</subParameter>
            </parameter>
            <parameter name="type">
                <subParameter name="value" code="0">ok</subParameter>
            </parameter>
            <parameter name="ifNo">
                <subParameter name="line" code="0"></subParameter>
                <subParameter name="action" code="0">do_nothing</subParameter>
            </parameter>
        </action>
    </script>
</scriptfile>
Je voudrais uniquement récupérer testOK malheureusement je ne comprend rien aux expression régulière quelqu'un pourrait me dire comment çà fonctionne ?
L'idéal serait de pouvoir lui dire de prendre la valeur entre ,' et ','
j'avais essayer avec un

Code: Select all

var Nom;
var X;
X = Nom.indexOf("','");
Nom = (Nom.substring(1,X);
X = Nom.indexOf(",'");
Nom = (Nom.substring(X,20);
mais çà ne fonctionne pas
User avatar
Jmgr
Admin
Posts: 1651
Joined: 07 Dec 2005, 15:45
Contact:

Re: Presse papier

Post by Jmgr »

Voila un tuto : http://www.siteduzero.com/tutoriel-3-81 ... egexp.html

Et voila un bout de code pour ton problème :

Code: Select all

var str = "javascript:CreateUnit(212207012,'TESTOK','w0KGgoAAAANSUhEUgAAACoAAAAMEAQAAADurzu4AAAAAmJLR0T//xSrMc0AAAAJcEhZcwAAAEgAAABIAEbJaz4AAAHlSURBVDjLzZQ/S8NQFMWvGm0LVlTa6FDopkgmFRc/gKvg4KCgoODk5kdwFEEQ7OAi6CCIe2kHnRXcBDso7kJLpNV00J/DNTRN88/NBw9uOCfnnPdyc0X++cpkIDHZsvzkP7wsIgMDyfkjIwm4Y2PJBP3Gc3Od54WFvx0i8aEhm4WLC2g2oV6H01MYHu7mjI9DowHBopDLwfk52HbzGbTO5eL0i9MQ5+0xOTsDgJUV2N3V+uiom3N4yO8SEZma6g4MpRLAfglge1uZJydx+nHehYLHB2xbCUNDMDqqda3WwYvF10nwBp2Z8Qet1RQ1Td0AT09x+nHevhtttZSQTkMmA+DYnSBXewAbG96gvRofH4oaBgwOat1qhenD52eo93RIz8L1tZLX1mB9XeuvL8VmZ+HhAfr7o4N+f7sY9PW5Gvk8ROuHYwEmplm9B2i34fYW3t6gXlesUoGlJa2jgurNmHfQe6OmCeVysH44JhIxhcAw2scANzfecP4lIpJKQaEAlgXw+Njp0YkJt0dTKX8vGwY4jqsvIpLPu1+iF/OFq1Z1PMzPw+ammqyu+gdv9I0eHCi6taXb+9cH68dhASaLi9qHjgMvL7CzE8wLDqr/eDYLl5dq+v6us9Gdo+H6yxYk8RYR+QHaiEALmvVbpwAAAABJRU5ErkJggg==');";
var regex = new RegExp("^javascript:CreateUnit\\([\\d]+,'(.+)','.+'\\);$");
var resultat = regex.exec(str)[1];
"My software never has bugs. It just develops random features."
Post Reply