cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Problems with scripted components

AndyWesterman
12-Amethyst

Problems with scripted components

Hello All,

I've written 2 mathcad sheets that are intended to interact, information is shared between them

& this works well when they are opened manually.

I'm now adding an OpenWorkSheet function to automatically open whichever sheet is not yet open & this is causing a headache.

Files attached show the problem ( the open worksheet function would normally be hidden in a referenced file)

Even if the function is diasbled Mathcad stll detects the script & refuses to open the second file with an "unknown error".

(Note the 2nd file will open if the scripted function is deleted)

The work around at the moment is to set script security to low & all is fine.

I just don't like leaving the setting down there!

Does anyone know a better work around?

After this I would like to maximise the window & tile the sheets, I've looked in the help files but its not obvious.

Has anyone tried this & have a function to do it or suggestions where I might find information about the command structure required?

Regards

Andy

2 REPLIES 2

There's nothing you can do to solve the problem with script warnings, except set the security to low.

To maximize and then tile the windows you need to first get the screen size. Use this code:

Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2")


Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0)


For Each objItem in colItems

intHorizontal = objItem.ScreenWidth

intVertical = objItem.ScreenHeight

Next

There doesn't seem to be a wat to really maximize the application, so all you can do is set the top, left, height, and width based on the screen size. Then use Windows property to get the Windows collection. For each window in the collection make sure the WindowState property is set to mcNormal (i.e. it's resizable), then set the top, left, width and size.

Thanks Richard,

Info regarding interactio between windows & any application is verydifficult to find & even harder to understand.

Pointed me in a 'right' direction (I hope).

If I have any success then I will post what I can on the forum.

Regards

Andy

Announcements

Top Tags