Back to issues with old scripts.

39 views
Skip to first unread message

Matthew Hirsch

unread,
Jul 9, 2021, 5:51:12 PM7/9/21
to mapi...@googlegroups.com

I am getting back to trying to figure out how to get these old scripts running on newer versions of mapinfo.

From previous discussions I believe the run menu commands are the issue, but I am not sure what to use instead.

 

They are crude at best and run until you crash the system.

 

These scripts start with a map window and a layout window open.  

Land File has three columns; Franchise, Filename and Scale.

 

Here is the complete code for reference.

 

!Workspace

!Version 700

!Charset WindowsLatin1

 

'Make sure window order goes map then layout.

Select COL1, COL2, Scale from Land group by COL1, Scale into Layinfo

 

Set CoordSys Layout Units "in"

 

dim ID as string

dim Title as string

dim Lastrow as integer

 

fetch first from layinfo

ID=layinfo.COL1

Title=layinfo.COL2

 

select * from land where COL1 = ID into mapex

select * from zones where Fran = ID into select_zones

run menu command 620

Add Map Layer select_zones

Add Map Layer select_zones

Add Map Layer mapex

Set Map Window frontwindow() Zoom Entire layer 1

dim Scale as string*3

scale = MapperInfo( FrontWindow(), 2)

Set Map

  Layer 2

    Display Global

    Global Pen (1,2,0) Brush (2,16765136,16777215) Symbol (35,0,12) Line (1,2,0) Font ("Arial",0,9,0)

    Label Line None Position Center Font ("Arial",0,9,0) Pen (1,2,0)

      With Zone

      Parallel On Auto Off Overlap Off Duplicates On Offset 2

      Visibility On

  Layer 3

    Display Global

    Global Pen (4,65,16711680) Brush (1,16777215,16777215) Symbol (35,0,12) Line (1,2,0) Font ("Arial",0,9,0)

    Label Line None Position Center Font ("Arial",0,9,0) Pen (1,2,0)

      With Zone

      Parallel On Auto Off Overlap Off Duplicates On Offset 2

      Visibility On

 

Set Map  Order Layers 3 DestGroupLayer 0 Position 9

Set Map  Order Layers 2 DestGroupLayer 0 Position 93

 

'Get title (ID) and scale text locations from saved workspace and include here.

run menu command 622

Create Text Title (1.6465,0.1715) (6.0889,0.4) Font ("Arial",1,14,0)

Create Text Scale     (7.5958,0.4347) (7.7,0.5111) Font ("Arial",1,5,0)

Set Window frontwindow() title ID + "_map"

 

printwin

 

fetch last from layout1

lastrow = layout1.rowid

select * from layout1 where rowid>lastrow-2

delete from selection

 

undim ID

undim Title

undim Scale

undim Lastrow

 

'Replicate this command by land or port rows-1

Run Application "Mult2land.WOR"

Run Application "Mult2land.WOR"

Run Application "Mult2land.WOR"

 

--------------------------------------

 

!Workspace

!Version 700

!Charset WindowsLatin1

 

 

dim ID as string

dim Title as string

dim Lastrow as integer

 

fetch next from layinfo

ID=layinfo.COL1

Title=layinfo.COL2

 

select * from land where COL1 = ID into mapex

select * from zones where Fran = ID into select_zones

run menu command 620

Add Map Layer select_zones

Add Map Layer select_zones

Add Map Layer mapex

Set Map Window frontwindow() Zoom Entire layer 1

dim Scale as string*3

scale = MapperInfo( FrontWindow(), 2)

Set Map

  Layer 2

    Display Global

    Global Pen (1,2,0) Brush (2,16765136,16777215) Symbol (35,0,12) Line (1,2,0) Font ("Arial",0,9,0)

    Label Line None Position Center Font ("Arial",0,9,0) Pen (1,2,0)

      With Zone

      Parallel On Auto Off Overlap Off Duplicates On Offset 2

      Visibility On

  Layer 3

    Display Global

    Global Pen (4,65,16711680) Brush (1,16777215,16777215) Symbol (35,0,12) Line (1,2,0) Font ("Arial",0,9,0)

    Label Line None Position Center Font ("Arial",0,9,0) Pen (1,2,0)

      With Zone

      Parallel On Auto Off Overlap Off Duplicates On Offset 2

      Visibility On

 

Set Map  Order Layers 3 DestGroupLayer 0 Position 9

Set Map  Order Layers 2 DestGroupLayer 0 Position 93

 

'Get title (ID) and scale text locations from saved workspace and include here.

run menu command 622

Create Text Title (1.6465,0.1715) (6.0889,0.4) Font ("Arial",1,14,0)

Create Text Scale     (7.5958,0.4347) (7.7,0.5111) Font ("Arial",1,5,0)

Set Window frontwindow() title ID + "_map"

 

printwin

 

fetch last from layout1

lastrow = layout1.rowid

select * from layout1 where rowid>lastrow-2

delete from selection

 

undim ID

undim Title

undim Scale

undim Lastrow

 

 

Peter Horsbøll Møller

unread,
Jul 10, 2021, 5:19:03 AM7/10/21
to mapi...@googlegroups.com

Hey Matthew

 

You have highlighted two Run Menu Command statements that you think is the cause of your problem.

 

The first, calling menu ID 620, creates a new Layout (Designer) window

 

Here you can use the Layout statement instead. But do you need another Layout? You wrote that you already have a layout window open

 

Layout Designer

        [ Position ( x, y ) [ Units paperunits ] ]

        [ Width window_width [ Units paperunits ] ]

        [ Height window_height [ Units paperunits ] ]

        [ { Min | Max | Floating | Docked | Tabbed | AutoHidden } ]

 

The second, calling menu ID 622, I don’t know what does.

I can’t find menu ID 622 in older or the newest Menu.def.

 

Can you share what it is supposed to do?

 

Have you had a look at the SiteMapper tool in the MapInfo Marketplace to see if that might help you produce these outputs?

 

Peter Horsbøll Møller

www.precisely.com

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: mapi...@googlegroups.com <mapi...@googlegroups.com> On Behalf Of Matthew Hirsch
Sent: 9. juli 2021 23:51
To: mapi...@googlegroups.com
Subject: [MI-L] Back to issues with old scripts.

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/SJ0PR04MB75019D6D490CEBBE97DD140FAB189%40SJ0PR04MB7501.namprd04.prod.outlook.com.

Matthew Hirsch

unread,
Jul 11, 2021, 7:29:16 PM7/11/21
to MapInfo-L
Peter, 

You are correct that the layout is already open.   

it seems that with this version 700 workspace script it somehow brings the map window back to the front.
When I removed the "run menu command 620" from the second workspace, on the second map I got "Error Expecting Mapper Window"

It appears the "run menu command 622" is bringing the layout window to the front for printing.   When I removed it, MIP printed the map only, not the full layout.
I set it to 621 and it tried to print the a company logo.

So I need to figure out what the menu command is to bring layers to the front for printing.  

I will look at the SiteMapper Tool to see if that can replace this,  but right now, I'd like to see if we can get this working on Version 2019 instead of having to use version 11.

Thank you.
Matthew
Reply all
Reply to author
Forward
0 new messages