xref: /haiku/3rdparty/mmu_man/scripts/dumpwin.sh (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1#!/bin/sh
2
3unescape_url () {
4    echo -e "$(echo $*|sed 's/%/\\\x/g')"
5}
6
7
8
9
10dumpview () {
11
12#    echo "$2= $1 of Window $WIN ="
13#    echo "${2}APP=$APP"
14#    echo "${2}WIN=$WIN"
15#echo hey "$APP" count View of $1 Window $WIN
16
17    local CNT="$(hey "$APP" count View of $1 Window $WIN | grep result | cut -d" " -f 7)"
18
19    if [ -z "$CNT" ]; then
20#	echo "NULL"
21	return 0
22    fi
23
24#    echo "${2}CNT=$CNT="
25
26    if [ "$CNT" -lt 1 ]; then
27	return 0
28    fi
29
30    local C=0
31
32    while [ $C -lt $CNT ]; do
33	local INAME="$(hey "$APP" get InternalName of View $C of $1 Window $WIN | grep result | cut -d" " -f 7)"
34	echo "$2:: View $C/$CNT ($INAME) ( View $C of ${1}Window $WIN )"
35#	hey "$APP" get View $C of $1 Window $WIN | awk " { print \"  $2\" \$0 } "
36#	hey "$APP" getsuites of View $C of $1 Window $WIN | grep Label >/dev/null
37
38#	if hey "$APP" getsuites of View $C of $1 Window $WIN | grep Label >/dev/null; then
39#	    echo hey "$APP" getsuites of View $C of $1 Window $WIN | grep Label
40#	    hey "$APP" get Label of View $C of $1 Window $WIN | grep result | awk " { print \"  $2\" \$0 } "
41#	fi
42
43#	if hey "$APP" getsuites of View $C of $1 Window $WIN | grep Text >/dev/null; then
44#	    echo hey "$APP" getsuites of View $C of $1 Window $WIN | grep Text
45#	    hey "$APP" get Text of View $C of $1 Window $WIN | grep result | awk " { print \"  $2\" \$0 } "
46#	fi
47
48	if hey "$APP" getsuites of View $C of $1 Window $WIN | grep Value >/dev/null; then
49	    echo hey "$APP" getsuites of View $C of $1 Window $WIN | grep Value
50	    hey "$APP" get Value of View $C of $1 Window $WIN | grep result | awk " { print \"  $2\" \$0 } "
51	fi
52
53#hey "$APP" getsuites of View $C of $1 Window $WIN | awk " { print \"  $2\" \$0 } "
54
55	dumpview "View $C of $1" "  $2"
56	let C="$C + 1"
57    done
58
59    echo "$2<"
60}
61
62if [ "$#" -lt 2 ]; then
63echo "$0 App Window"
64exit 1
65fi
66
67
68APP="$1"
69WIN="$2"
70
71dumpview
72
73