IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Scripts/Batch Discussion :

Chemins relatifs avec Windows XP


Sujet :

Scripts/Batch

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mars 2009
    Messages : 17
    Par défaut Chemins relatifs avec Windows XP
    j'ai un batch qui en appelle un autre sous windows XP.

    Le 1er accepte les chemins relatifs et appelle le 2eme batch avec 'do'

    Le 2e batch par contre n'est plus capable de fonctionner en chemin relatif par rapport au repertoire où il se trouve et semble se referer à un autre emplacement. Avec des chemins en dur, ça marche par contre.

    Bizarrement les mêmes batchs fontionnent avec windows 7 64 ?!

    Quelqu'un pourrait il m'aider à finir ces petits batch pour qu'ils fonctionnent en chemins relatifs ?

    (Rémunération possible)

  2. #2
    Membre Expert Avatar de Drizzt [Drone38]
    Homme Profil pro
    Directeur de projet
    Inscrit en
    Mai 2004
    Messages
    1 001
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Directeur de projet

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 001
    Par défaut
    Il va falloir que tu postes ton code si tu veux de l'aide.

    Pour citer un autre membre de ce forum, l'application boule de crystal n'est pas installée sur mon poste actuellement et je n'ai pas d'animal mort à portée de main pour tenter d'en découvrir plus.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mars 2009
    Messages : 17
    Par défaut
    Il y a 2 fichiers :
    Deposer le PDF sur moi.bat
    pdf2megazine.bat
    pdf2swf.exe


    Leur utilité : Convertir un PDF en fichiers SWF.

    On fait un glisser/déposer d'un PDF sur 'Deposer le PDF sur moi.bat', celui-ci demande le nombre de pages à convertir en SWF.
    Il appelle après, le fichier 'pdf2megazine.bat'.
    Celui ci appelle l’exécutable 'pdf2swf.exe' qui transforme le PDF en fichiers SWF.

    J'ai placé ces fichiers dans un ZIP ci-joint

    Les chemins relatifs ne marchent pas avec Windows XP

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mars 2009
    Messages : 17
    Par défaut Deposer le PDF sur moi.bat
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @echo off
    set /p input=How many pages?  
    For %%a in (%1) do pdf2megazine.bat "%%~fa" "../PAGEFLIP/page" %input%
    pause

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Mars 2009
    Messages : 17
    Par défaut pdf2megazine.bat
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    @echo off
    ECHO pdf2megazine v1.0
    ECHO.
    
    IF [%1]==[] GOTO help
    IF [%2]==[] GOTO help
    IF [%3]==[] GOTO help
    
    :: Get the page width and height for the header (because I do not know how to escape the
    :: exclamation mark when ENABLEDELAYEDEXPANSION is active, and it's needed in the doctype)
    SET WIDTH=275
    IF NOT [%4]==[] SET WIDTH=%4
    set height=400
    IF NOT [%5]==[] SET HEIGHT=%5
    
    :: Write XML header and lead in
    ECHO ^<?xml version="1.0" encoding="utf-8"?^>> megazine.xml
    ECHO ^<!DOCTYPE book SYSTEM "http://megazine.mightypirates.de/megazine.dtd"^>>> megazine.xml
    ECHO ^<book pagewidth="%WIDTH%" pageheight="%HEIGHT%"^>>> megazine.xml
    ECHO     ^<chapter^>>> megazine.xml
    
    :: Activate it, for modulo calculation in the loop
    SETLOCAL ENABLEDELAYEDEXPANSION
    
    
    :: --------------------------------------------------------------
    :: The installation location of the swftools pdf to swf converter
    :: CHANGE THIS TO WHERE YOUR INSTALLATION OF THE SWFTOOLS IS
    
    
    SET PDF2SWF=pdf2swf.exe
    
    :: --------------------------------------------------------------
    :: Test if the swftools are installed...
    IF NOT EXIST %PDF2SWF% GOTO swftools
    
    :: Process path input and remove quotation marks
    SET FROM=%1
    SET FROM=%FROM:"=%
    SET TO=%2
    SET TO=%TO:"=%
    SET PAGES=%3
    SET WIDTH=275
    IF NOT [%4]==[] SET WIDTH=%4
    set height=400
    IF NOT [%5]==[] SET HEIGHT=%5
    ECHO Reading %PAGES% pages from file %FROM% and writing them to files named
    ECHO %TO%1.swf through %TO%%PAGES%.swf...
    
    :: Process all pages
    FOR /L %%i IN (1,1,%pages%) DO (
        ECHO Processing page %%i
    
        %PDF2SWF% -q -t -T 8 -s zoom=100 -p %%i "%FROM%" "%TO%%%i.swf"
    
    :: Check if it's an even or odd page and position the zoom button accordingly
        SET TEST=%%i
        SET /A TEST%%=2
        IF "!TEST!"=="1" ECHO         ^<page^>^<img src="%to%%%i.swf" width="%width%" height="%height%" hires="%to%%%i.swf" static="true" gallery="pages" iconpos="left"/^>^</page^>>> megazine.xml
        IF "!TEST!"=="0" ECHO         ^<page^>^<img src="%to%%%i.swf" width="%width%" height="%height%" hires="%to%%%i.swf" static="true" gallery="pages"/^>^</page^>>> megazine.xml
    )
    
    :: Write lead out to XML
    ECHO     ^</chapter^>>> megazine.xml
    ECHO ^</book^>>> megazine.xml
    
    ENDLOCAL
    
    ECHO Done.
    
    GOTO end
    
    :swftools
    ECHO [EN - English]
    ECHO.
    ECHO This script requires the "pdf2swf" program from swftools.
    ECHO See http://www.swftools.org/pdf2swf.html
    ECHO.
    ECHO If you do not have them installed, please download now and install.
    ECHO Then change this file (open it with Notepad), by setting where
    ECHO you installed it (default is C:\swftools, if you did not use a
    ECHO custom path you do not need to change this file).
    ECHO Look for the line
    ECHO.
    ECHO   SET PDF2SWF=P:\swftools\pdf2swf.exe
    ECHO.
    ECHO and change the path to your installation location.
    ECHO.
    GOTO end
    
    :help
    ECHO [EN - English]
    ECHO.
    ECHO How to use:
    ECHO pdf2megazine.bat "path/to/source.pdf" "target/path/base_name" numberofpages
    ECHO                  [pagewidth] [pageheight]
    ECHO.
    ECHO First parameter  is the path to the source pdf file. Required parameter.
    ECHO Second parameter is the base name of the resulting files. Page number and
    ECHO     extension is added automatically. Required parameter.
    ECHO Third parameter  is the number of pages to extract from the source pdf
    ECHO     document. Required parameter.
    ECHO Fourth and fifth parameter are the target page width and height in pixels.
    ECHO    Optional parameters.
    ECHO.
    ECHO e.g.: pdf2megazine.bat "C:/MyPDF.pdf" "files/page" 12
    ECHO.
    ECHO This will produce 12 swf files in the folder <Folder with BAT>/files/ with the
    ECHO names page1.swf through page12.pdf.
    ECHO.
    ECHO Also note that in the folder of the bat file an XML file is generated that
    ECHO represents a book with the extracted pages. If you wish to use this XML file
    ECHO (which is recommended) you should use relative path for the resulting files
    ECHO that can be used in the XML file, because it is used directly for generation.
    ECHO To achieve this, place the bat file into the folder with your megazine.swf file.
    ECHO.
    GOTO end
    
    :end
    
    pause

  6. #6
    Membre Expert Avatar de Drizzt [Drone38]
    Homme Profil pro
    Directeur de projet
    Inscrit en
    Mai 2004
    Messages
    1 001
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Directeur de projet

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 001
    Par défaut
    Lorsque tu dis que cela ne fonctionne pas j'imagine que tu parles de la ligne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    %PDF2SWF% -q -t -T 8 -s zoom=100 -p %%i "%FROM%" "%TO%%%i.swf"
    A priori ton FROM est déjà un chemin absolu, le problème doit donc venir du TO.
    Tu peux faire un dans ton second batch pour voir ou il se trouve. Il se peut que tu es justement un comportement différent sur XP et 7 lorsque tu fais ton drag & drop.
    Je suis sous XP et à priori il reste sur C:\ lors que je fais un drag & drop.

    La solution peut simplement etre de faire un cd "chemin d'accès du repertoire du pdf" dans ton second batch. Tu peux soit le récupérer depuis ton FROM ou passer un nouvel argument du type lors de l'appel au second batch.

Discussions similaires

  1. [MySQL] Chemin relatif avec header
    Par JackFinick dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 09/09/2011, 13h54
  2. Chemin relatif avec Excel
    Par benenutz dans le forum Visual Studio
    Réponses: 2
    Dernier message: 18/05/2011, 19h18
  3. Problème de chemin relatif avec TOMCAT pour mes CSS et images
    Par hitokiri06 dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 16/11/2010, 19h00
  4. Réponses: 3
    Dernier message: 24/04/2008, 12h30
  5. chemin relatif avec vba d'autocad
    Par vince6262 dans le forum Général VBA
    Réponses: 10
    Dernier message: 15/02/2008, 11h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo