Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Selectionbox, script which opens more than one file at once? Post 302215881 by tio86 on Thursday 17th of July 2008 11:19:56 AM
Old 07-17-2008
well this is what i have so far (see below)

i changed the function of the script a little but it works.
till now it opens the .doc files in the chosen folder (and then save it to mif).

but actually the script should open a template (N:Fame71\Templates) and import one file (the first) from the chosen folder, than save it and close it.
than the script should do it with all other files (second, third, ...) in the folder (open template, import .doc, save, close).

well i really have no idea how to write thes commands Smilie

maybe you can help me,
thx

Script:

Code:
   If fslVersionMajor < 3
      MsgBox 'FrameScript Version 3 oder hoeher wird benoetigt!';
      LeaveSub;
   EndIf



   DIALOGBOX Type(ChooseFile) Title('Verzeichnis der Doc-Dateien waehlen:')
             Mode(OpenDirectory) Button(btnvar) NewVar(gvFolder);
   IF btnvar = CANCELBUTTON
      LEAVESUB;
   ENDIF
   
   SET dirpath = gvFolder;
   
   SET totalFileCount = 0;
   SET MifFileCount = 0;
   SET WrdFileCount = 0;
   LOOP ForEach(File) In(dirpath) LoopVar(fname)
      SET totalFileCount = totalFileCount + 1;
      Find '.doc' InString(fname) NoCase Suffix  ReturnStatus(SuffixFound);
      IF SuffixFound   
         SET WrdFileCount = WrdFileCount + 1;
         RUN OpenImportAndSaveIt DocFileName(fname);
      ENDIF
   ENDLOOP
                  
   MsgBox 'Fertig  '+CHARLF+totalFileCount+' Dateien im Ordner '+
    CHARLF+WrdFileCount+' Doc-Dateien '+
      CHARLF+MifFileCount+' Mif-Dateien erzeugt';



SUB OpenImportAndSaveIt using DocFileName

   RUN isDocOpenAlready FileName(DocFileName) returns DocObj(docVar);
   IF docVar = 0
      SET AlreadyOpen = False;
      SET errorcode = 0;
      OPEN Document File(DocFileName) FileIsOldVersion FontNotFoundInDoc NewVar(docVar);
      IF ErrorCode not 0
         DISPLAY  'Error Opening Document-'+DocFileName+'  Msg-'+ErrorMsg;
      ENDIF
   ELSE
      SET AlreadyOpen = True;
   ENDIF

   IF docVar not = 0
      RUN GetNewFileSuffix InFileName(DocFileName) NewSuffix('mif') returns OutFileName(ofilename);
      SET errorcode = 0;
      SAVE Document DocObject (docVar) File(ofilename) FileType(SaveFmtInterchange);
      IF ErrorCode not = 0
         DISPLAY 'Save to MIF failed. Errorcode='+ErrorCode+'   Msg='+ErrorMsg;
      ELSE
         WRITE console 'Document ('+DocFileName+') saved as '+ofilename;
         SET MIFFileCount = MIFFileCount + 1;
      ENDIF;
    SAVE Document DocObject (docVar) FileType(SaveFmtInterchange);
    CLOSE Document DocObject(docVar) IGNOREMODS;
   ENDIF;

ENDSUB



SUB isDocOpenAlready using filename DocObj

   GET String FromString (filename) Uppercase NewVar(tfilename);
   SET DocObj = 0;
   LOOP foreach(Doc) In(Session) LoopVar(testdocobj)
      GET String FromString (testdocobj.Name) Uppercase NewVar(tname);
      IF tname = tfilename
         SET DocObj = testdocobj;
         LEAVELOOP;
      ENDIF
   ENDLOOP

ENDSUB



SUB GetNewFileSuffix using InFileName NewSuffix returns OutFileName
   
   SET SuffixDotPosition = -1;
   SET SuffixFound = 0;
   FIND '.' InString(InFileName) Back ReturnPos(SuffixDotPosition) ReturnStatus(SuffixFound);
   IF SuffixFound
      GET String FromString(InFileName) EndPos(SuffixDotPosition) NewVar(OutFileName)
      SET OutFileName = OutFileName + NewSuffix;
   ELSE
      SETOutFileName = OutFileName + '.' + NewSuffix;
   ENDIF

   Delete Var(dotpos);
   Delete Var(SuffixFound);
   
ENDSUB


 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

VI opens slow

when ever I try to vi a file that resides on another machines it takes forever for it to open. Does anyone have any ideas why it would be doing this? I have 7 unix machines and the only two that do this are both running tru64. (6 Replies)
Discussion started by: Moca4444
6 Replies

2. Linux

Port that a process opens up

Hi all, I have a process with PID as 12456. Could you please let me know how do i find out what is the port that process listens upon in Linux? Thanks in Advance, Pankajakshan (1 Reply)
Discussion started by: Pankajakshan
1 Replies

3. IP Networking

Port that a process opens up

Hi all, I have a process with PID as 12456. Could you please let me know how do i find out what is the port that process listens upon in Linux? Thanks in Advance, Pankajakshan (2 Replies)
Discussion started by: Pankajakshan
2 Replies

4. Shell Programming and Scripting

Position to last line when vi opens a file.

Any Idea without entering any keystroke I can go to end of line in vi when I opening the file. When I am opening Vi I want to goto last line. when I give vi + filename it does not work. Any clue why it does not work. Thanks. (3 Replies)
Discussion started by: ekb
3 Replies

5. OS X (Apple)

Programatically change which opens a file type

Hi there, If we have 2 apps on our customers machines that can both open files of a certain file extension, is there any way via shell commands to set which application should be the default? Essentially, I'm hoping to replicate Get Info > Open With > Change All, but using a script. Thanks... (0 Replies)
Discussion started by: davewg
0 Replies

6. Shell Programming and Scripting

include virtual perl-script - submit button opens a new page..

hello 2 all I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"--> filename is a name of the file which script is using the script is used for a score show (the number... (0 Replies)
Discussion started by: tip78
0 Replies

7. Web Development

include virtual perl-script - submit button opens a new page..

hello 2 all I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"--> filename is a name of the file which script is using the script is used for a score show (the number... (3 Replies)
Discussion started by: tip78
3 Replies

8. UNIX for Advanced & Expert Users

sendmails works, but opens 43 file handles per email -> problem

I'm using Sendmail 8.13.8 on a CentOS 5.5 vServer (Virtuozzo). I'm using a loop in PHP to send a lot of HTML-mails via sendmail. Each mail is a mail with individual statistics for our users, so its not mass mailing, bcc is not an option. It all works fine, but when I take a closer look there... (2 Replies)
Discussion started by: ZX81
2 Replies

9. Shell Programming and Scripting

[bash] Extra tab opens

Hello everyone, This code is working right using mate-terminal but with xfce4-terminal for some reason, it open up an extra tab... Could someone please help me out to understand why this is happening? #!/bin/bash cd "$(dirname "$0")"/files tab=" --tab" title=" --title" options=()... (2 Replies)
Discussion started by: soichiro
2 Replies
RESET(7)						  PostgreSQL 9.2.7 Documentation						  RESET(7)

NAME
RESET - restore the value of a run-time parameter to the default value SYNOPSIS
RESET configuration_parameter RESET ALL DESCRIPTION
RESET restores run-time parameters to their default values. RESET is an alternative spelling for SET configuration_parameter TO DEFAULT Refer to SET(7) for details. The default value is defined as the value that the parameter would have had, if no SET had ever been issued for it in the current session. The actual source of this value might be a compiled-in default, the configuration file, command-line options, or per-database or per-user default settings. This is subtly different from defining it as "the value that the parameter had at session start", because if the value came from the configuration file, it will be reset to whatever is specified by the configuration file now. See Chapter 18, Server Configuration, in the documentation for details. The transactional behavior of RESET is the same as SET: its effects will be undone by transaction rollback. PARAMETERS
configuration_parameter Name of a settable run-time parameter. Available parameters are documented in Chapter 18, Server Configuration, in the documentation and on the SET(7) reference page. ALL Resets all settable run-time parameters to default values. EXAMPLES
Set the timezone configuration variable to its default value: RESET timezone; COMPATIBILITY
RESET is a PostgreSQL extension. SEE ALSO
SET(7), SHOW(7) PostgreSQL 9.2.7 2014-02-17 RESET(7)
All times are GMT -4. The time now is 06:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy