Can't save AppleScript file when created by touch
I'm used to create file using touch
before opening them with open
. But I came to this following problem :
When I do this with AppleScript files AppleScript Editor
is able to open the file but unable to save the file. I get The document "xxx.scpt" could not be saved
.
Any idea why ?
Solution 1:
It doesn't work with .scpt files but it does work with .applescript files.
If you save an empty script as .scpt in AppleScript Editor, it looks like this:
hexdump -C Desktop/Untitled.scpt
00000000 46 61 73 64 55 41 53 20 31 2e 31 30 31 2e 31 30 |FasdUAS 1.101.10|
00000010 0e 00 00 00 04 0f ff ff 00 01 00 02 00 03 01 ff |................|
00000020 ff 00 00 0d 00 01 00 03 6c 00 02 00 00 00 04 00 |........l.......|
00000030 04 ff fe ff fd 0d 00 04 00 03 52 00 00 00 00 00 |..........R.....|
00000040 04 ff fc 00 05 ff fb 0a ff fc 00 18 2e 61 73 63 |.............asc|
00000050 72 65 72 72 20 2a 2a 2a 2a 00 00 00 00 00 00 90 |rerr ****.......|
00000060 00 2a 2a 2a 2a 0d 00 05 00 01 6d 00 00 00 02 00 |.****.....m.....|
00000070 03 00 06 0e 00 06 00 01 b1 00 07 11 00 07 00 74 |...............t|
00000080 00 54 00 68 00 69 00 73 00 20 00 73 00 63 00 72 |.T.h.i.s. .s.c.r|
00000090 00 69 00 70 00 74 00 20 00 63 00 6f 00 6e 00 74 |.i.p.t. .c.o.n.t|
000000a0 00 61 00 69 00 6e 00 73 00 20 00 75 00 6e 00 63 |.a.i.n.s. .u.n.c|
000000b0 00 6f 00 6d 00 70 00 69 00 6c 00 65 00 64 00 20 |.o.m.p.i.l.e.d. |
000000c0 00 63 00 68 00 61 00 6e 00 67 00 65 00 73 00 20 |.c.h.a.n.g.e.s. |
000000d0 00 61 00 6e 00 64 00 20 00 63 00 61 00 6e 00 6e |.a.n.d. .c.a.n.n|
000000e0 00 6f 00 74 00 20 00 62 00 65 00 20 00 72 00 75 |.o.t. .b.e. .r.u|
000000f0 00 6e 00 2e 02 ff fb 00 00 01 ff fe 00 00 01 ff |.n..............|
00000100 fd 00 00 0e 00 02 00 00 0f 10 00 03 00 03 ff fa |................|
00000110 00 08 00 09 01 ff fa 00 00 10 00 08 00 01 ff f9 |................|
00000120 0a ff f9 00 18 2e 61 65 76 74 6f 61 70 70 6e 75 |......aevtoappnu|
00000130 6c 6c 00 00 80 00 00 00 90 00 2a 2a 2a 2a 0e 00 |ll........****..|
00000140 09 00 07 10 ff f8 00 0a ff f7 ff f6 00 0b 00 0c |................|
00000150 ff f5 0a ff f8 00 18 2e 61 65 76 74 6f 61 70 70 |........aevtoapp|
00000160 6e 75 6c 6c 00 00 80 00 00 00 90 00 2a 2a 2a 2a |null........****|
00000170 0d 00 0a 00 01 6b 00 00 00 00 00 04 00 0d 02 00 |.....k..........|
00000180 0d 00 02 00 01 ff f4 02 ff f4 00 00 01 ff f7 00 |................|
00000190 00 02 ff f6 00 00 10 00 0b 00 00 10 00 0c 00 01 |................|
000001a0 00 06 11 ff f5 00 05 29 6a e0 15 0f 61 73 63 72 |.......)j...ascr|
000001b0 00 01 00 0c fa de de ad |........|
000001b8
You can create a new .scpt file with osacompile:
osacompile -e \"\" -o new.scpt