/ BBS in a Box 10
/ BBS In A Box Volume X (AMUG) (January 1994).bin / Files / System7 tools / AppleScript / Script Tools.cpt / Script Tools / Examples / File IO Example ![]() | < prev | next > |
MacBinary | 1993-07-08 | 1.6 KB | [TEXT/ToyS] |
Confidence | Program | Detection | Match Type | Support |
---|---|---|---|---|
10% | dexvert | MacBinary (archive/macBinary) | fallback | Supported |
1% | dexvert | Text File (text/txt) | fallback | Supported |
100% | file | MacBinary II, inited, Thu Jul 8 18:43:01 1993, modified Thu Jul 8 18:43:01 1993, creator 'ToyS', type ASCII, 828 bytes "File IO Example" , at 0x3bc 632 bytes resource | default (weak) | |
99% | file | data | default | |
74% | TrID | Macintosh plain text (MacBinary) | default | |
25% | TrID | MacBinary 2 | default (weak) | |
100% | siegfried | fmt/1762 MacBinary (II) | default | |
100% | lsar | MacBinary | default |
id metadata | |
---|---|
key | value |
macFileType | [TEXT] |
macFileCreator | [ToyS] |
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0f 46 69 6c 65 20 49 | 4f 20 45 78 61 6d 70 6c |..File I|O Exampl|
|00000010| 65 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |e.......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 54 6f 79 | 53 01 00 00 00 00 00 00 |.TEXTToy|S.......|
|00000050| 00 00 00 00 00 03 3c 00 | 00 02 78 a8 62 53 75 a8 |......<.|..x.bSu.|
|00000060| 62 53 75 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |bSu.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b0 3a 00 00 |........|.....:..|
|00000080| 2d 2d 0d 2d 2d 09 41 73 | 6b 20 74 68 65 20 75 73 |--.--.As|k the us|
|00000090| 65 72 20 74 6f 20 66 6f | 72 20 74 68 65 20 6e 61 |er to fo|r the na|
|000000a0| 6d 65 20 61 6e 64 20 6c | 6f 63 61 74 69 6f 6e 20 |me and l|ocation |
|000000b0| 6f 66 20 74 68 65 20 6e | 65 77 20 66 69 6c 65 0d |of the n|ew file.|
|000000c0| 2d 2d 0d 73 65 74 20 6e | 65 77 46 69 6c 65 20 74 |--.set n|ewFile t|
|000000d0| 6f 20 63 68 6f 6f 73 65 | 20 6e 65 77 20 66 69 6c |o choose| new fil|
|000000e0| 65 20 77 69 74 68 20 70 | 72 6f 6d 70 74 20 22 50 |e with p|rompt "P|
|000000f0| 69 63 6b 20 61 20 6e 65 | 77 20 66 69 6c 65 20 6e |ick a ne|w file n|
|00000100| 61 6d 65 3a 22 0d 73 65 | 74 20 6e 65 77 46 69 6c |ame:".se|t newFil|
|00000110| 65 50 61 74 68 20 74 6f | 20 28 66 6f 6c 64 65 72 |ePath to| (folder|
|00000120| 20 72 65 74 75 72 6e 65 | 64 20 6f 66 20 6e 65 77 | returne|d of new|
|00000130| 46 69 6c 65 20 61 73 20 | 73 74 72 69 6e 67 29 20 |File as |string) |
|00000140| 26 20 28 6e 61 6d 65 20 | 72 65 74 75 72 6e 65 64 |& (name |returned|
|00000150| 20 6f 66 20 6e 65 77 46 | 69 6c 65 29 0d 0d 2d 2d | of newF|ile)..--|
|00000160| 0d 2d 2d 09 49 66 20 74 | 68 65 20 66 69 6c 65 20 |.--.If t|he file |
|00000170| 61 6c 72 65 61 64 79 20 | 65 78 69 73 74 73 20 64 |already |exists d|
|00000180| 65 6c 65 74 65 20 69 74 | 0d 2d 2d 0d 69 66 20 28 |elete it|.--.if (|
|00000190| 72 65 70 6c 61 63 69 6e | 67 20 6f 66 20 6e 65 77 |replacin|g of new|
|000001a0| 46 69 6c 65 29 20 74 68 | 65 6e 20 c2 0d 09 64 65 |File) th|en ...de|
|000001b0| 6c 65 74 65 20 66 69 6c | 65 20 61 6c 69 61 73 20 |lete fil|e alias |
|000001c0| 6e 65 77 46 69 6c 65 50 | 61 74 68 0d 0d 2d 2d 0d |newFileP|ath..--.|
|000001d0| 2d 2d 09 43 72 65 61 74 | 65 20 74 68 65 20 66 69 |--.Creat|e the fi|
|000001e0| 6c 65 20 61 6e 64 20 77 | 72 69 74 65 20 73 6f 6d |le and w|rite som|
|000001f0| 65 20 64 61 74 61 20 74 | 6f 20 69 74 0d 2d 2d 0d |e data t|o it.--.|
|00000200| 63 72 65 61 74 65 20 66 | 69 6c 65 20 28 6e 61 6d |create f|ile (nam|
|00000210| 65 20 72 65 74 75 72 6e | 65 64 20 6f 66 20 6e 65 |e return|ed of ne|
|00000220| 77 46 69 6c 65 29 20 69 | 6e 20 28 66 6f 6c 64 65 |wFile) i|n (folde|
|00000230| 72 20 72 65 74 75 72 6e | 65 64 20 6f 66 20 6e 65 |r return|ed of ne|
|00000240| 77 46 69 6c 65 29 20 c2 | 0d 09 6f 77 6e 65 72 20 |wFile) .|..owner |
|00000250| 22 74 74 78 74 22 20 2d | 2d 20 54 65 61 63 68 54 |"ttxt" -|- TeachT|
|00000260| 65 78 74 0d 73 65 74 20 | 72 65 66 4e 75 6d 20 74 |ext.set |refNum t|
|00000270| 6f 20 6f 70 65 6e 20 66 | 69 6c 65 20 61 6c 69 61 |o open f|ile alia|
|00000280| 73 20 6e 65 77 46 69 6c | 65 50 61 74 68 0d 77 72 |s newFil|ePath.wr|
|00000290| 69 74 65 20 66 69 6c 65 | 20 72 65 66 4e 75 6d 20 |ite file| refNum |
|000002a0| 74 65 78 74 20 22 54 68 | 69 73 20 66 69 6c 65 20 |text "Th|is file |
|000002b0| 69 73 20 61 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |is an ex|ample of|
|000002c0| 20 61 20 73 69 6d 70 6c | 65 20 74 65 78 74 20 66 | a simpl|e text f|
|000002d0| 69 6c 65 20 77 68 69 63 | 68 20 63 61 6e 20 62 65 |ile whic|h can be|
|000002e0| 20 63 72 65 61 74 65 64 | 20 75 73 69 6e 67 20 74 | created| using t|
|000002f0| 68 65 20 46 69 6c 65 20 | 49 2f 4f 20 41 70 70 6c |he File |I/O Appl|
|00000300| 65 53 63 72 69 70 74 20 | 61 64 64 69 74 69 6f 6e |eScript |addition|
|00000310| 73 20 70 72 6f 76 69 64 | 65 64 20 69 6e 20 53 63 |s provid|ed in Sc|
|00000320| 72 69 70 74 20 54 6f 6f | 6c 73 22 0d 77 72 69 74 |ript Too|ls".writ|
|00000330| 65 20 66 69 6c 65 20 72 | 65 66 4e 75 6d 20 74 65 |e file r|efNum te|
|00000340| 78 74 20 22 22 0d 77 72 | 69 74 65 20 66 69 6c 65 |xt "".wr|ite file|
|00000350| 20 72 65 66 4e 75 6d 20 | 74 65 78 74 20 22 2d 4d | refNum |text "-M|
|00000360| 61 72 6b 22 0d 63 6c 6f | 73 65 20 66 69 6c 65 20 |ark".clo|se file |
|00000370| 72 65 66 4e 75 6d 0d 2d | 2d 0d 2d 2d 09 4e 6f 74 |refNum.-|-.--.Not|
|00000380| 65 20 68 6f 77 20 54 65 | 61 63 68 54 65 78 74 20 |e how Te|achText |
|00000390| 74 72 65 61 74 73 20 65 | 61 63 68 20 6c 69 6e 65 |treats e|ach line|
|000003a0| 20 61 73 20 61 20 73 65 | 70 65 72 61 74 65 20 70 | as a se|perate p|
|000003b0| 61 72 61 67 72 61 70 68 | 2e 0d 2d 2d 00 00 00 00 |aragraph|..--....|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 00 00 01 00 00 00 02 1e | 00 00 01 1e 00 00 00 5a |........|.......Z|
|00000410| 14 8f 31 7e 13 5e f3 14 | 8f 31 5e 32 3b af 5e 20 |..1~.^..|.1^2;.^ |
|00000420| 3b af 16 20 7f 99 dd 00 | 0c 16 6f 31 5e 7b 3b af |;.. ....|..o1^{;.|
|00000430| 0f 46 69 6c 65 20 49 4f | 20 45 78 61 6d 70 6c 65 |.File IO| Example|
|00000440| 02 00 00 00 50 61 72 74 | 53 49 54 21 00 00 00 00 |....Part|SIT!....|
|00000450| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00000460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000470| 00 00 a8 b3 c5 ad 00 00 | 00 00 00 00 02 78 31 16 |........|.....x1.|
|00000480| 56 5f 06 68 7a 7c 7f d4 | c0 7e 0c 8b da 31 67 1e |V_.hz|..|.~...1g.|
|00000490| ea 63 67 9a dd 00 10 67 | 8e 6d 7c f8 04 67 16 56 |.cg....g|.m|..g.V|
|000004a0| 5f 04 c6 7a 7c e6 08 f8 | 02 96 67 19 ea 63 7f 60 |_..z|...|..g..c.`|
|000004b0| 9a f7 04 f7 02 e4 f8 09 | 67 f7 02 96 7e 14 67 9a |........|g...~.g.|
|000004c0| 16 56 5f 06 7c 7a 7c 7f | d4 b9 14 f7 04 7e 0f e4 |.V_.|z|.|.....~..|
|000004d0| 62 60 e4 f8 06 67 7e 18 | 96 67 1c ea 62 67 9a dd |b`...g~.|.g..bg..|
|000004e0| 00 1d 60 27 f7 01 ee 00 | 7f ec 00 67 c3 67 27 f7 |..`'....|...g.g'.|
|000004f0| 01 92 7e 10 f8 07 f7 07 | 7f 62 ef 7e 09 ee 00 f8 |..~.....|.b.~....|
|00000500| 00 00 00 c2 46 69 6c 65 | 20 49 4f 20 41 64 64 69 |....File| IO Addi|
|00000510| 74 69 6f 6e 20 45 78 61 | 6d 70 6c 65 0d 43 6f 70 |tion Exa|mple.Cop|
|00000520| 79 72 69 67 68 74 20 a9 | 20 31 39 39 33 20 4d 61 |yright .| 1993 Ma|
|00000530| 72 6b 20 41 6c 6c 64 72 | 69 74 74 0d 41 6c 6c 20 |rk Alldr|itt.All |
|00000540| 52 69 67 68 74 73 20 52 | 65 73 65 72 76 65 64 0d |Rights R|eserved.|
|00000550| 0d 54 68 69 73 20 73 63 | 72 69 70 74 20 69 6c 6c |.This sc|ript ill|
|00000560| 75 73 74 72 61 74 65 73 | 20 68 6f 77 20 74 6f 20 |ustrates| how to |
|00000570| 75 73 65 20 74 68 65 20 | 53 63 72 69 70 74 20 54 |use the |Script T|
|00000580| 6f 6f 6c 73 20 66 69 6c | 65 20 49 4f 20 63 6f 6d |ools fil|e IO com|
|00000590| 6d 61 6e 64 73 20 74 6f | 20 63 72 65 61 74 65 20 |mands to| create |
|000005a0| 61 20 74 65 78 74 20 66 | 69 6c 65 20 61 6e 64 20 |a text f|ile and |
|000005b0| 77 72 69 74 65 20 73 6f | 6d 65 20 74 65 78 74 20 |write so|me text |
|000005c0| 74 6f 20 69 74 2e 00 00 | 00 3e 00 03 00 00 00 00 |to it...|.>......|
|000005d0| 00 0c 00 09 00 10 00 00 | 00 0a 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 4b 00 0e 00 0a | 00 10 00 00 00 0c 00 00 |...K....|........|
|000005f0| 00 00 00 00 00 00 00 4d | 00 0c 00 09 00 16 00 00 |.......M|........|
|00000600| 00 0a 00 00 00 00 00 00 | 00 00 00 12 00 2b 00 04 |........|.....+..|
|00000610| 01 ff 02 6a 00 2b 00 04 | 01 e6 02 6a 00 00 00 00 |...j.+..|...j....|
|00000620| 01 00 00 00 02 1e 00 00 | 01 1e 00 00 00 5a 00 29 |........|.....Z.)|
|00000630| 25 94 0b 06 00 00 00 1c | 00 5a 00 02 54 45 58 54 |%.......|.Z..TEXT|
|00000640| 00 00 00 1a 73 74 79 6c | 00 00 00 26 57 50 6f 73 |....styl|...&WPos|
|00000650| 00 00 00 32 04 68 ff ff | 00 00 00 00 00 29 23 70 |...2.h..|.....)#p|
|00000660| 04 68 ff ff 00 00 00 c6 | 00 29 23 6c 00 80 ff ff |.h......|.)#l....|
|00000670| 00 00 01 08 00 29 23 7c | 00 00 00 00 00 00 00 00 |.....)#||........|
+--------+-------------------------+-------------------------+--------+--------+