Selectionbox, script which opens more than one file at once?
hello everybody
I´m very new at shell and programming 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.
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
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
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)
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)
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)
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)
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)
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)
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)
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)
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)