Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Searching for a 'shape' in Microsoft's "Visio"
#3
Hello!

You can do this with VBA Macro(s) in MS VISIO itself...

Or write an MS Office VISIO - Add-In - but then it gets complicated - I've already done that...

Or create a QM-Macro: 

(Tested with MS-VISIO V 2016 - to date...)
 
Code:
Copy      Help
int w=win("*Visio *" "VISIOA" "" 1)
str Oldname
str sSearchedPageName="YourSearchedPageName"
act w

int w2=win("Suchen" "AxonDlgCls");err
clo w2;err

key CP (#100)         ;; STRG+BILD-NACH-OBEN goto the 1.st Page - i think 100 are enough

rep
,,;1
,Acc a.Find(w "WINDOW" "" "class=AfxWnd140u[]id=59904" 0x1004)
,str name=a.Name
,out a.Name
,if a.Name=sSearchedPageName
,,mes "Page Found"
,,;Do something
,,ret 0
,if Oldname=a.Name 
,,mes "Nothing found..."
,,ret 1
,act w
,Oldname=a.Name 
,key CQ          ;; STRG+BILD-NACH-UNTEN

Disadvantage of this macro: Visio window must be active (and remain active during the execution of the macro...) - Sends keyboard shortcuts to Windows

or

1. The VISIO page tabs at the bottom of the drawing area do not currently offer any directly accessible object - therefore choose the option:
Select VISIO drawing sheet  from the User-customized menu and select your Page..
The VISIO Menu Entry  "DrawingPage" (or GoToDrawingPage) or so (In German it's:  "Zeichenblatt")  is not a standard Visio menu item, i added a new Group in the Ribbon-Menu (under Tab: "Ansicht"...) rename it (to "Zeichenblatt...) and place the "DrawingPage" entry in this group..
Then you can Call this entry from QM...
   

In the Zeichenblatt (DrawingPage) Dialog there is also an identifier whether the page is active or not - this must of course be removed for a correct search result....

Of course, various (language...) adjustments still need to be made...
First, always close any existing dialog (search window, etc.), otherwise unexpected behavior may occur!
 
Code:
Copy      Help
int w=win("*Visio *" "VISIOA" "" 1)
int w2=win("Zeichenblatt" "AxonDlgCls");err
clo w2;err
Acc a.Find(w "PAGETAB" "Ansicht" "class=NetUIHWND" 0x1005)
a.DoDefaultAction
a.Find(w "PUSHBUTTON" "Zeichenblatt..." "class=NetUIHWND" 0x1005)
a.DoDefaultAction

err+
,mes "Menu-Button NOT Found" "" "xt"
,ret 1
err-

int iZ
str sSearchPageName="YourSearchPageName"

rep
,iZ+1
,w2=wait(3 WC win("Zeichenblatt" "AxonDlgCls"))
,1
,a.Find(w2 "LISTITEM" "" "class=ListBox[]id=10" 0x1005 0 iZ )
,str name=a.Name
,name=name.left(name (name.len -2))
,out name
,if sSearchPageName = name
,,a.DoDefaultAction
,,mes "Found"
,,;;Do something
,,break

ret

err+
,mes "NOT Found" "" "xt"
,ret 1
err-


then:

2. Call the Search and Adjust it for Shape-Name... and so on..
 First, always close any existing dialog (search window, etc.), otherwise unexpected behavior may occur!
 
Code:
Copy      Help
int w=win("*Visio *" "VISIOA" "" 1)

int w1=win("Suchen" "#32770");err
Acc a.Find(w1 "PUSHBUTTON" "OK" "class=Button[]id=2" 0x1005);err
1
a.DoDefaultAction;err
a.DoDefaultAction;err  ;;BUG?


int w2=win("Suchen" "AxonDlgCls");err
clo w2;err

act w
'Cf
w2=wait(3 WV win("Suchen" "AxonDlgCls"))
act w2
paste("SearchShapeName")

w2=win("Suchen" "AxonDlgCls")
a.Find(w2 "CHECKBUTTON" "Shape-Text" "class=Button[]id=60" 0x1005)
if a.State=1048592
,a.DoDefaultAction


a.Find(w2 "CHECKBUTTON" "Shape-Daten" "class=Button[]id=61" 0x1005)
if a.State=1048592
,a.DoDefaultAction

a.Find(w2 "CHECKBUTTON" "Shape-Name" "class=Button[]id=62" 0x1005)
if a.State=1048576
,a.DoDefaultAction

a.Find(w2 "CHECKBUTTON" "Benutzerdefinierte Zelle" "class=Button[]id=63" 0x1005)
if a.State=1048592
,a.DoDefaultAction


a.Find(w2 "CHECKBUTTON" "Nur ganzes Wort suchen" "class=Button[]id=29" 0x1005)
if a.State=1048592
,a.DoDefaultAction

a.Find(w2 "CHECKBUTTON" "Groß-/Kleinschreibung beachten" "class=Button[]id=28" 0x1005)
if a.State=1048592
,a.DoDefaultAction

a.Find(w2 "CHECKBUTTON" "Zeichenbreite beachten" "class=Button[]id=30" 0x1005)
if a.State=1048592
,a.DoDefaultAction

a.Find(w2 "RADIOBUTTON" "Aktuelles Zeichenblatt" "class=Button[]id=21" 0x1005 3)
a.DoDefaultAction

a.Find(w2 "PUSHBUTTON" "Weitersuchen" "class=Button[]id=1" 0x1005)
a.DoDefaultAction

You can see an example of QM - VISIO (& INKSCAPE) control (German Version) here: VISIO Vektor Frame Generator

wfg. from Schindi aus Austria


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)