Jump to content

problem with a variable


Recommended Posts

Hi,

I try to do a simple script: It should open all the pdf files in a folder, select all the text, copy it in the notepad and save this with the name of the pdf file.

For doing this I used the FileFindFirstFile.au3 from Valuater (thanks !!!) Nevertheless when I want to save the file, it always paste the same wrong truncated name of one of my pdf file. Would you have any idea, please?

Here is my script:

$search = FileFindFirstFile("*.pdf") ; file find first file of all files in the directory.

; Check if the search was successful.
If $search = -1 Then; if the variable, search equals negative one, then,
    MsgBox(0, "Error", "No files/directories matched the search pattern"); a message box will appear.
    Exit; and then exit the program.
EndIf; ends an, if, statement.

While 1; while, is a loop waiting for an action.
    $file = FileFindNextFile($search); finds the, next file, from the original search.
    $chemin = "L:\02 Lexique 3\01 Corpus\Metro\"
; Option j'ouvre Reader puis la fenêtre d'ouverture de fichiers
    Run("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe")
    WinWaitActive("Adobe Reader")
; Ouvre la fenêtre de navigation
    Send("^o")
; Envoie le chemin du fichier
    Send($chemin)
    Send($file)
    Send("{ENTER}")
    WinWait("", "", 3)
    Send("^a")
    Send("^c")
; Attendre que ce soit fait 
    WinWait("", "", 10)
; Fermer Adobe Reader
    Send("!{F4}")
    
; Se mettre dans notepad
    Run("C:\Windows\system32\notepad.exe")
    WinWaitActive("Untitled - Notepad")
; Colle
    Send("^v")
; Va dans le menu Fichier
    WinWait("", "", 3)
    Send("!f")
; Va sur Enregistrer sous
    Send("{DOWN 3}")
; Tape le nom du nouveau fichier
    Send($file)
    WinWait("", "", 3)
; Valide le nom du fichier
    Send("{ENTER}")
; Ferme le notepad
    Send("!{F4}")
    WinWait("", "", 10)
;MsgBox(4096, "File:", $file); message box to display the file that was found.
    
WEnd; returns to the while, loop.

; Close the search handle.
FileClose($search)

Thanks in advance,

Boris

Edited by pandelis
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...