Selectionbox, script which opens more than one file at once?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Selectionbox, script which opens more than one file at once?
# 1  
Old 07-15-2008
Question Selectionbox, script which opens more than one file at once?

hello everybody

I´m very new at shell and programming Smilie and i have the following question/problem:

I need a script for framemaker (based on shell) which opens a new document from a template (.fm). Then imports a .doc file and then save it as a .mif.

Actually my script works with one document!
But i need a script where i can select more than one document, but in my selectionbox i can only select one file!
Is there any trick to make a selectionbox where i can select more than one file at once?

My english is not very good by i hope you understand want i am trying to explain. I actually asked this question in more than one forum but nobody knew the answer, maybe you can help me.

please help me Smilie

thanx a lot
# 2  
Old 07-16-2008
Show what you have so far, please.
# 3  
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


# 4  
Old 07-18-2008
Quote:
I need a script for framemaker
Ah sorry, didn't see that - have no clue of that scripting language, sorry. Ein Shell Script wäre vermutlich kein Problem gewesen Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
Login or Register to Ask a Question