2 ** ImageDimensions.CEd V1.0 (31-Aug-97) For CygnusEd & Visage
4 ** This script will paste the width and height for the image
5 ** specified within an <IMG> tag.
6 ** Bind it to a hotkey, and press that key while
7 ** the cursor is placed inside an <Img Src=...> tag.
8 ** This doesn't work for pictures given an absolute path,
9 ** like http://... but you probably knew that ;^)
12 ** For feedback write Allan Odgaard <Duff@DIKU.DK>
15 /* Please customize this line */
16 Visage = "Duff's:Graphics/Visage"
18 /* The rest should work without your interference :-) */
21 Address 'TEXTEDITOR-DEMO.1'
23 Path = 'Data:Homepage'
24 GetCursor Column; CursorX = RESULT
25 GetCursor Line; LineNr = RESULT
26 GetLine; Line = RESULT
28 EndTag = Right(Line, Length(Line)-CursorX)
29 EndTagPos = Pos(">", EndTag)
31 If(EndTagPos > 0) Then
33 Line = Upper(Left(Line, EndTagPos+CursorX))
34 StartTagPos = Pos("GMI<", Reverse(Line))
35 If(StartTagPos > 0) Then
37 Tag = Right(Line, StartTagPos+3)
38 PicturePos = Pos("SRC=", Tag)
39 If(PicturePos > 0) Then
41 Name = Right(Tag, Length(Tag)-PicturePos-3)
43 If(Left(Name, 1) = '"') Then
44 Parse Var Name '"' FileName '"' rest
47 Parse Var Name FileName '>' rest
48 Parse Var FileName FileName ' ' rest
51 If(Right(Path, 1) = ':') Then
52 File = Path || FileName
53 Else File = Path || '/' || FileName
55 Address Command Visage '>T:ImgDimensions "'File'" Info'
58 Open('Size','T:ImgDimensions','Read')
61 Info = Right(Info, Length(Info)-10)
64 Parse Var Info width 'x' height 'x' rest
67 GotoColumn Length(Line)-StartTagPos+1
68 Text '" Width=' || width || ' Height=' || height || '"'