123 Save As Script Help

123 Save As Script Help

Post by Matt Craf » Tue, 30 Jan 2001 11:08:34



Hi

I hope someone can help me with this. I am new to using Lotus Script for
123 and do not know how to code something.

I have a very big spreadsheet model which contains many tabs. I wrote
a script which makes a copy of this model and deletes the sheets
the user does not want. I bring up the Save-As dialog, what I do not know is
how to code if the user hits the CANCEL box or the X that is the upper left
hand corner of the Save As procedure, so I can break out of
my script if they hit them.

I have looked at the Lotus Site but that and the online docs were not
that helpfull. If someone can help me I would appreciate it

 
 
 

123 Save As Script Help

Post by Harlan Grov » Wed, 31 Jan 2001 04:32:40




...

Quote:>I have a very big spreadsheet model which contains many tabs. I wrote
>a script which makes a copy of this model and deletes the sheets
>the user does not want. I bring up the Save-As dialog, what I do not
>know is how to code if the user hits the CANCEL box or the X that is
>the upper left hand corner of the Save As procedure, so I can break
>out of my script if they hit them.

>I have looked at the Lotus Site but that and the online docs were not
>that helpfull. If someone can help me I would appreciate it

Here's an example of checking if the file was saved by comparing before
and after dialog file date/time stamp.

Sub ugh
  Dim dts As Variant, fn As String

  fn = Mid(CurrentDocument.Name, 3, Len(CurrentDocument.Name) - 4)
  dts = Filedatetime(fn)

  .MacroRunText |{dialog? "Save-As"}|

  If Filedatetime(fn) = dts Then
    Msgbox "Not saved"
    Exit Sub
  End If

  'rest of procedure here
End Sub

And, yes, Lotus has pretty poor documentation for LotusScript with 123.

Sent via Deja.com
http://www.deja.com/

 
 
 

123 Save As Script Help

Post by Matt Craf » Wed, 31 Jan 2001 12:28:35


Harlan
Thanks for responding. I appreciate it. I am not sure if that is what I am
looking for either that or I am being dense and not seeing it

What I am looking for is I am running a sub that envokes the SAVE-AS
procedure. What I need to be able to do is if the user hits the CANCEL
button or the X in the upper right hand corner of the SAVE-AS procedure I
want to exit out of the SAVE-AS procedure and  and not execute the rest of
my script which follows. I dont know how to code to look at the CANCEL
button or that X in the SAVE-AS procedure to see if the user hits them

Again if you could help me or point me in the proper direction I would
appreciate. I wish there was a book on Lotus Script for 1-2-3 but I have
been unable to find one, as the Lotus docs are very poor




> ...
> >I have a very big spreadsheet model which contains many tabs. I wrote
> >a script which makes a copy of this model and deletes the sheets
> >the user does not want. I bring up the Save-As dialog, what I do not
> >know is how to code if the user hits the CANCEL box or the X that is
> >the upper left hand corner of the Save As procedure, so I can break
> >out of my script if they hit them.

> >I have looked at the Lotus Site but that and the online docs were not
> >that helpfull. If someone can help me I would appreciate it

> Here's an example of checking if the file was saved by comparing before
> and after dialog file date/time stamp.

> Sub ugh
>   Dim dts As Variant, fn As String

>   fn = Mid(CurrentDocument.Name, 3, Len(CurrentDocument.Name) - 4)
>   dts = Filedatetime(fn)

>   .MacroRunText |{dialog? "Save-As"}|

>   If Filedatetime(fn) = dts Then
>     Msgbox "Not saved"
>     Exit Sub
>   End If

>   'rest of procedure here
> End Sub

> And, yes, Lotus has pretty poor documentation for LotusScript with 123.

> Sent via Deja.com
> http://www.deja.com/

 
 
 

123 Save As Script Help

Post by Harlan Grov » Thu, 01 Feb 2001 02:39:35




...
>What I am looking for is I am running a sub that envokes the SAVE-AS
>procedure. What I need to be able to do is if the user hits the CANCEL
>button or the X in the upper right hand corner of the SAVE-AS
>procedure I want to exit out of the SAVE-AS procedure and  and not
>execute the rest of my script which follows. I dont know how to code
>to look at the CANCEL button or that X in the SAVE-AS procedure to see
>if the user hits them
...




>>...
>>>I have a very big spreadsheet model which contains many tabs. I wrote
>>>a script which makes a copy of this model and deletes the sheets
>>>the user does not want. I bring up the Save-As dialog, what I do not
>>>know is how to code if the user hits the CANCEL box or the X that is
>>>the upper left hand corner of the Save As procedure, so I can break
>>>out of my script if they hit them.
...
>>Here's an example of checking if the file was saved by comparing
>>before and after dialog file date/time stamp.

>>Sub ugh
>>  Dim dts As Variant, fn As String

>>  fn = Mid(CurrentDocument.Name, 3, Len(CurrentDocument.Name) - 4)
>>  dts = Filedatetime(fn)

>>  .MacroRunText |{dialog? "Save-As"}|

>>  If Filedatetime(fn) = dts Then
>>    Msgbox "Not saved"
>>    Exit Sub
>>  End If

>>  'rest of procedure here
>>End Sub

...

OK, I may have been being dense about SaveAs - the filename may change
during the operation. Assuming the file in question is 123's active
document, it can be referred to as CurrentDocument in LotusScript. It's
filename might change as a result of a successful file-save operation.
Indeed, if the filename for CurrentDocument changes from one side of
the statement that displays the SaveAs dialog, that's a sure sign the
file was in fact saved. But I digress.

Unless you're playing games with your system clock, the date/time stamp
(latest modification date/time as displayed in a DIR listing or in
Windows Explorer when viewing Details) will be earlier than the
date/time at which you display the SaveAs dialog, so store the file's
date/time stamp BEFORE displaying the SaveAs dialog. After the SaveAs
dialod closes, either the user has saved the file or cancelled/closed
the dialog. If s/he has saved the file, its current date/time stamp
given by

Filedatetime(Mid(CurrentDocument.Name,3,Len(CurrentDocument.Name)-4))

will be greater than (i.e., later than) the stored date/time stamp;
otherwise, if s/he hasn't saved the file, the current date/time stamp
should be the same as the stored value. To abort the remainder of the
script if the file hasn't been saved, compare the current date/time
stamp to the stored value, and if they're the same (i.e., equal) then
exit the procedure (Exit Sub).

The point is if you're using standard dialogs, I don't believe there's
any way to trap the Cancel button, close button ("X" in the upper-right
corner) or Escape key. You have to test the file itself once the dialog
closes. CAVEAT: I use 123R97 which only provides the macro {DIALOG?} to
run built-in dialogs; if 123R9+ can call built-in dialogs directly
(perhaps as methods of the Application class), then there may be a
return value to test. I dunno.

Sent via Deja.com
http://www.deja.com/

 
 
 

123 Save As Script Help

Post by Matt Craf » Thu, 01 Feb 2001 11:42:58


Harlan

Ok I got you now - you are talking about comparing the date time stamp of
the workbook BEFORE and AFTER to see if a SAVE AS has been - Interesting
idea, I hadn't thought about that. That was a bit more envolved then I
wanted to get.

The 2nd part that you mention -- which I copied below is what I was thinking
about.
If everything in 123 is an OBJECT then the cancel button, the X etc should
be object that you
can reference. Anyway the caveat is SHOULD be. But it sounds like that we
cant
I just picked up an EXCEL book so I was going to read that to see if I can
find something out there since VBA and Script are suppose to be similiar

Anyway thanks for the help - so far I have just written very specific
instructions
detailing the bad things that happen if  break out of the SAVE AS routine.
The customer
seems to thing that is good enough BUT we know not everyone reads
instructions.

Matt

> The point is if you're using standard dialogs, I don't believe there's
> any way to trap the Cancel button, close button ("X" in the upper-right
> corner) or Escape key. You have to test the file itself once the dialog
> closes. CAVEAT: I use 123R97 which only provides the macro {DIALOG?} to
> run built-in dialogs; if 123R9+ can call built-in dialogs directly
> (perhaps as methods of the Application class), then there may be a
> return value to test. I dunno.






> ...
> >What I am looking for is I am running a sub that envokes the SAVE-AS
> >procedure. What I need to be able to do is if the user hits the CANCEL
> >button or the X in the upper right hand corner of the SAVE-AS
> >procedure I want to exit out of the SAVE-AS procedure and  and not
> >execute the rest of my script which follows. I dont know how to code
> >to look at the CANCEL button or that X in the SAVE-AS procedure to see
> >if the user hits them
> ...




> >>...
> >>>I have a very big spreadsheet model which contains many tabs. I wrote
> >>>a script which makes a copy of this model and deletes the sheets
> >>>the user does not want. I bring up the Save-As dialog, what I do not
> >>>know is how to code if the user hits the CANCEL box or the X that is
> >>>the upper left hand corner of the Save As procedure, so I can break
> >>>out of my script if they hit them.
> ...
> >>Here's an example of checking if the file was saved by comparing
> >>before and after dialog file date/time stamp.

> >>Sub ugh
> >>  Dim dts As Variant, fn As String

> >>  fn = Mid(CurrentDocument.Name, 3, Len(CurrentDocument.Name) - 4)
> >>  dts = Filedatetime(fn)

> >>  .MacroRunText |{dialog? "Save-As"}|

> >>  If Filedatetime(fn) = dts Then
> >>    Msgbox "Not saved"
> >>    Exit Sub
> >>  End If

> >>  'rest of procedure here
> >>End Sub
> ...

> OK, I may have been being dense about SaveAs - the filename may change
> during the operation. Assuming the file in question is 123's active
> document, it can be referred to as CurrentDocument in LotusScript. It's
> filename might change as a result of a successful file-save operation.
> Indeed, if the filename for CurrentDocument changes from one side of
> the statement that displays the SaveAs dialog, that's a sure sign the
> file was in fact saved. But I digress.

> Unless you're playing games with your system clock, the date/time stamp
> (latest modification date/time as displayed in a DIR listing or in
> Windows Explorer when viewing Details) will be earlier than the
> date/time at which you display the SaveAs dialog, so store the file's
> date/time stamp BEFORE displaying the SaveAs dialog. After the SaveAs
> dialod closes, either the user has saved the file or cancelled/closed
> the dialog. If s/he has saved the file, its current date/time stamp
> given by

> Filedatetime(Mid(CurrentDocument.Name,3,Len(CurrentDocument.Name)-4))

> will be greater than (i.e., later than) the stored date/time stamp;
> otherwise, if s/he hasn't saved the file, the current date/time stamp
> should be the same as the stored value. To abort the remainder of the
> script if the file hasn't been saved, compare the current date/time
> stamp to the stored value, and if they're the same (i.e., equal) then
> exit the procedure (Exit Sub).

> The point is if you're using standard dialogs, I don't believe there's
> any way to trap the Cancel button, close button ("X" in the upper-right
> corner) or Escape key. You have to test the file itself once the dialog
> closes. CAVEAT: I use 123R97 which only provides the macro {DIALOG?} to
> run built-in dialogs; if 123R9+ can call built-in dialogs directly
> (perhaps as methods of the Application class), then there may be a
> return value to test. I dunno.

> Sent via Deja.com
> http://www.deja.com/

 
 
 

1. HELP! 123 Save As .txt ERROR?

Hi!

  Can anyone out there help me out ?

  I'm trying to save a .txt ASCII file from Lotus 123 5.0 in NT4 and I
get the error 'Unable to access output device' ....

  I would be most grateful of any assistance here to avoid having to
switch operating systems or appplications.

 Thanks.

 Gareth Bonner
 CSG Hewlett Packard (Bristol)

2. WTT: Libretto 50 for LG Phenom Ultra

3. 123 PASSWORD SAVED ****HELP*****

4. Ask for conferences and workshops i

5. Lotus 123 V9 Scripts

6. Using Russian text at a AS400?

7. Lotus 123 script

8. Convert 123 script to excel 2000 VB

9. (DBRJ) scripting Go or GoTo in 123

10. (DBRJ) scripting an iteration of an iteration in 123

11. New to scripting in 123