This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Function key_macro()
' must have a document window
if zeus.is_document() = 0 then Exit Function
' get current line position using the tag
tag_line_num = zeus.macro_tag("$Line")
' get current line position
line_num = zeus.get_line_pos()
' get current cursor position
cursor_pos = zeus.get_cursor_pos()
' build up a message
message = "Tag Line: " & tag_line_num & " Line: " & line_num & " Cursor: " & cursor_pos
' display message in status bar
call zeus.message(message)
End Function
key_macro() 'run the macro
When run. the macro will display the current line and cursor position in the message section of the status bar and these details will match the line and cursor details shown on the right of the status bar.
My macro in vbs using Jussi's advice, which has the bonus of more info in the status box, to insert a Msgbox and Line number automatically in my Program via macro is as follows:
Function key_macro()
call zeus.screen_update_disable
' get current line position using the tag
tag_line_num = zeus.macro_tag("$Line")
' get current line position
line_num = zeus.get_line_pos()
' get current cursor position
cursor_pos = zeus.get_cursor_pos()
' build up a message
message = "Tag Line: " & tag_line_num & " Line: " & line_num & " Cursor: " & cursor_pos
' display message in status bar
call zeus.message(message)
call zeus.screen_update_enable
call zeus.screen_update
call zeus.write("Msgbox " &Chr(34) &"This is line Number " &line_num & Chr(34) )
End Function
key_macro() 'run the macro