home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog Special Freeware 31
/
FreelogHS31.iso
/
ArgentCompta
/
Bankperfect
/
bp.exe
/
Scripts
/
Replace
/
search_replace.py
< prev
Wrap
Text File
|
2005-10-14
|
2KB
|
51 lines
import BP
def Replace(S):
s, r = ESrc.Text, ERep.Text.replace(";", " ")
if s != r and s != "":
i = BP.AccountCurrent()
who = BP.Operationthirdparty[i]
inf = BP.OperationDetails[i]
ok = 0
for i in BP.VisibleLines():
if who[i].find(s) > -1:
who[i] = who[i].replace(s, r)
ok += 1
if inf[i].find(s) > -1:
inf[i] = inf[i].replace(s, r)
ok += 1
BP.AccountRefreshScreen()
if ok == 0: s = "Aucune occurence n'a ΘtΘ trouvΘe"
elif ok == 1: s = "Un remplacement a ΘtΘ effectuΘ"
else: s = "%d remplacements ont ΘtΘ effectuΘs" %ok
BP.MsgBox(s, 64)
f.Close()
def Check(S):
BOK.Enabled = ESrc.Text != "" and ERep.Text != ESrc.Text
f = CreateComponent("TForm", None)
f.Font.Name = "Tahoma"
f.SetProps(Position="poMainFormCenter", Width=450, Height=300, Caption="Remplacer", BorderStyle="bsSingle", BorderIcons=["biSystemMenu"])
l1 = CreateComponent("TLabel", f)
l1.SetProps(Parent=f, Left=30, Top=30, Width=305, Caption="Dans le texte des champs ½ tiers ╗ et ½ dΘtails ╗ :")
l1.Font.Style = ["fsBold"]
l2 = CreateComponent("TLabel", f)
l2.SetProps(Parent=f, Left=30, Top=50, Width=293, Caption="La recherche est sensible α la casse (majuscules, minuscules)")
l3 = CreateComponent("TLabel", f)
l3.SetProps(Parent=f, Left=30, Top=65, Width=274, Caption="et porte uniquement sur les lignes visibles (non filtrΘes).")
l4 = CreateComponent("TLabel", f)
l4.SetProps(Parent=f, Left=30, Top=115, Width=62, Caption="Rechercher :")
l5 = CreateComponent("TLabel", f)
l5.SetProps(Parent=f, Left=30, Top=155, Width=76, Caption="Remplacer par :")
ESrc = CreateComponent("TEdit", f)
ESrc.SetProps(Parent=f, Left=170, Top=110, Width=240, OnChange=Check)
ERep = CreateComponent("TEdit", f)
ERep.SetProps(Parent=f, Left=170, Top=150, Width=240, OnChange=Check)
BOK = CreateComponent("TButton", f)
BOK.SetProps(Parent=f, Left=120, Top=210, Width=100, Height=25, Caption="OK", Default=1, Enabled=0, OnClick=Replace)
BCl = CreateComponent("TButton", f)
BCl.SetProps(Parent=f, Left=230, Top=210, Width=100, Height=25, Caption="Annuler", Cancel=1, ModalResult=2)
f.ShowModal()