Print Data To File, Programmatically

Started by bruceam, September 30, 2019, 08:56:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bruceam

I am creating a Visio 2013 Smartshape which permits me to move a point around a field of regard, while displaying the coordinates of the point in realtime.  I would like to have a way (a double click, a keyboard shortcut, etc...) to grab these coordinates and append them to a data file (CSV, Excel, etc...) specified in the "Shape Data" section. 

Does anyone know how I could implement this?

Thank you in advanced.

bruceam

cliff50

#1
Hi Bruceam

I am using Visio pro 2016 64 bit

attached solution.

Move the rectangle around the page.....  the text fields display the X and Y position.
double click the rectangle and choose Report_1
Choose  Excel
The report should appear in excel format.

HTH
Cliff

Paul Herber

Quote from: bruceam on September 30, 2019, 08:56:18 PM
...while displaying the coordinates of the point in realtime...

I don't think you can show the coordinates in real-time as the shape is being moved, only when it is released.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

cliff50

Hi Paul,
yes I see what you mean .
When I use the mouse drag, the co-ordinates freeze until the mouse is released, as you describe.

However, when I hold the arrow keys on my machine, I see the co-ordinates increment with movement.
Not sure if it is a visual effect.
 
macro could be written to slide left right up down etc , I assume somewhere in the code >>  "doevents" would allow the co-ordinates to increment with movement. ( my assumption only at this point )

cheerio
Cliff

bruceam

Cliff,
Thank you for your suggestion.  I tried out the file you posted, and while it does output an ordered pair to a file, it isn't exactly what I am looking for.  If this were "C", I would be wanting the "Printf" function, or said more properly, I would want the Visio Shapesheet equivalent to the "C" printf function.  I desire to output the textual data in the background using parameters that have been entered into the shapesheet via the "Shape Data" window.  I would be doing this many, many times per instance, so the data must be appended to the targeted output file.  I will certainly remember the functionality you have demonstrated for other applications.

Thank you again.



Quote from: cliff50 on October 01, 2019, 01:37:08 AM
Hi Bruceam

I am using Visio pro 2016 64 bit

attached solution.

Move the rectangle around the page.....  the text fields display the X and Y position.
double click the rectangle and choose Report_1
Choose  Excel
The report should appear in excel format.

HTH
Cliff

cliff50

#5
Hi bruceam

Via a macro,  this attached solution will append to a text file the co-ordinates in sequence.

method: using attachment vsd and text file.

locate files in same folder.
move box to position with directional arrow keys.

movements automatically (APPEND) the X,Y co-ordinates onto the log.txt file

adjust the code to suite units etc
ensure "microsoft scripting" is checked in references

sorry, i loaded the wrong attachments before , these ones should work as decribed above.

cheerio
Cliff

Obsidian

Quote from: bruceam on September 30, 2019, 08:56:18 PM
...while displaying the coordinates of the point in realtime...
Not ideal solution but may be interesting.
It using Application event MouseMove.
And may be from the darkness something beautiful will rize