Problem to search string in the input file with vbscript

Hi,

I have installed last version of PdfCreator. Before, i was in 1.2.x(?) version.

I have a VBScript called in actions "running before saving" which research characters string in the input file.

Today, this program does'nt recognize the researched string while it was ok in precedent version.

I checked the parameters and options of PdfCreator and only Ghostscript version had changed.

I don't understand this problem. Please, could someone help me ?

Thanks to all contributors to this excellent program.

Sorry for my approximate English.

Hi,

could you post the script here or send it to us by mail?
We can gladly have a look at it.

regards,

Robin

Hi,

Thanks for your answer.

Here is my script :

Option Explicit

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim ftmp, ftxt, sep, deb, fin, chaine, txt, item, msg, motdeb, lgdeb, motfin
Dim objArgs, fname, fso, f, fstr

' Initialisation *********************
motdeb = "OOOO"
motfin = "OOOO"
sep = " "
chaine = "noged"
Set objArgs = WScript.Arguments

' Contrôles ************************
If objArgs.Count = 0 Then
 MsgBox "This script needs a parameter!", vbExclamation, "Recherche avant"
 WScript.Quit
End If

fname = objArgs(0)  ' contient le nom du fichier à imprimer

msgbox("le fichier : " & fname)

' Lecture du contenu du fichier à imprimer
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(fname, ForReading,,-1)
fstr = f.ReadAll

msgbox("le texte : " & fstr)

' Recherche d'une chaine bornée par motdeb et motfin contenant des paramètres séparés par sep

lgdeb = len(motdeb)
deb = InStr(1,fstr,motdeb)
fin = InStr(deb+lgdeb,fstr,motfin)
msgbox("début = " & deb & chr(13) & "fin = " & fin)

If deb<>0 Then ' la chaine est trouvée
  chaine = Mid(fstr,deb+lgdeb,fin-deb-lgdeb)
  msg = chaine & chr(13)
  txt = Split(chaine," ")
  for each item in txt
    msg = msg & item & chr(13)
  next
  msgbox ("propriétés :" & chr(13) & msg)
End If
f.Close

' Ecriture d'un fichier temporaire de paramètres destinés à la GED

ftmp = "\"  & "GEDIC-" & objArgs(1) & objArgs(2) & ".txt"  ' objArgs(1)= objArgs(2)=
msgbox(ftmp)
ftxt = chaine
msgbox(ftxt)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(ftmp, ForWriting, True)
f.Write ftxt
f.Close

 

Hi,


it is probably caused by <REDMON_USER> and <REDMON_SESSIONID>, as these tokens don’t exist any more. You can find a list of all currently usable tokens here: http://www.pdfforge.org/content/auto-save-mode

regards,

Robin

Hi Robin,

This is not the problem, with correct tokens there is the same phenomen : the text borned by "OOOO" is not founded, the variable "fstr" is empty and "deb" and "fin" are null.

Here is the text in à file.txt I want to to convert in pdf and in which I want to search a specific text : "Ceci est un fichier texte de test PdfCréator par JCV il contient cette chaine OOOOparam nature type tiers refOOOO qui contient les paramètres et mots clés du fichier pdf à créer."

Could you make test with these elements to constate and explain me my problem.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

Thank you very much.

 

Solo 79