![]() |
![]() |
#1 |
move $dff006,$dff180
Join Date: Feb 2014
Location: USA
Posts: 66
|
Very Basic Scripting. Confused.
Hi,
I've been lurking here for a while, it's a great board. So I have this text editor which ignores a given filename as parameter if the file does not yet exist. So I wrote this simple wrapper: Code:
.key file .bra { .ket } if "{file}" eq "" skip blank endif if not exists {file} echo >{file}.control "" ; create empty file for later comparison echo >{file} "" ; create dummy file for editor to open endif genam3 {file} skip check lab blank genam3 lab check if exists {file}.control cmp {file} {file}.control ; compare with empty file if not warn ; if it's the same, delete again (nothing was edited) delete {file} endif delete {file}.control ; otherwise only delete control file endif TIA. |
![]() |
![]() |
#2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
It works correctly for me. Which version of AmigaDOS do you use?
Can you attach the original file? I used cut & paste from there, but maybe the original file contains some strange character which was removed by the web browser. Note that your script will fail badly if the file name contains space characters. |
![]() |
![]() |
#3 |
move $dff006,$dff180
Join Date: Feb 2014
Location: USA
Posts: 66
|
I checked for strange characters but will provide the file anyway. I am on AmigaOS 1.3 (kickstart 34.5) This still gives the same error to me (endif missing).
Code:
The files do NOT contain identical datas. ENDIF missing if failed returncode 20 ![]() |
![]() |
![]() |
#4 |
move $dff006,$dff180
Join Date: Feb 2014
Location: USA
Posts: 66
|
Found the problem:
Apparently IF/ELSE/ENDIF statements must not be indented. ![]() |
![]() |
![]() |
#5 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
Quote:
No, this is not true. Indention is allowed. The problem is that the last line did not end with a newline character. If you had added an empty line to the end of the file it would have worked. |
|
![]() |
![]() |
#6 |
move $dff006,$dff180
Join Date: Feb 2014
Location: USA
Posts: 66
|
Oh?
![]() Interesting. I did not realize that. I removed all indenting on a hunch, must have fixed that issue while doing so. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
AmigaDOS scripting resources | Photon | Coders. System | 26 | 19 March 2018 14:51 |
UAE Scripting Layer | FrodeSolheim | support.FS-UAE | 15 | 26 January 2014 15:56 |
C= 64 BASIC as a Scripting Language | Charlie | Retrogaming General Discussion | 2 | 17 November 2008 14:23 |
AmigaDOS 1.3 Scripting Language | redblade | Coders. General | 10 | 16 August 2008 12:58 |
|
|