ChatGPT Show Me Diagrams Plugin ( Mermaid Chart )

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
smorgasbord
Posts: 493
Joined: 30 Sep 2013, 09:34

ChatGPT Show Me Diagrams Plugin ( Mermaid Chart )

02 Sep 2023, 01:45

Site : https://www.mermaidchart.com/

Only two level support as of now. That is heading (parent) with multiple sub headings (child)

HOW TO USE :

1)copy paste data from google spreadsheet or excel spreadsheet (with header row as the heading and all the subheadings/topic in the column below, by pressing CTRL+A, CTRL+C), save it in the same folder of script and name it GRAPHS.txt

2)Run the code below

3) paste content from clipboard ( relevant graph generator code already in clipboard) on to https://www.mermaidchart.com/app/projects/

graph is ready

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
DATA_SET := ""
gosub, data_

FileRead, K, GRAPHS.txt
array := StrSplit(K, "`r`n")

array_set := []

row_index := 1
col_index := 1

loop, % array.maxindex()
{

	lines := array[A_index]
	tabs := StrSplit(lines, "`t")
	loop, % tabs.maxindex()
	{
		array_set[row_index, col_index] := tabs[A_index]
		col_index := col_index+1
		highest_col := col_index-1
	}
col_index := 1
row_index := row_index + 1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
col_index := 1
row_index := 1

;~ MsgBox % array.maxindex()

loop, % highest_col
{
	;~ MsgBox % highest_col

	loop, % array.maxindex()
	{
		if ( strlen(array_set[row_index, col_index]) > 1 )
		{

			lock_row := row_index
			lock_col := col_index
			{
				if ( row_index > 2 )
				{
					;~ MsgBox
					StringTrimRight, DATA_SET,DATA_SET,5


					DATA_SET .= ";`n"

					DATA_SET .=   A_Z[lock_A_Z_index] . " --> " . A_Z[A_Z_index] . "[" . array_set[lock_row, lock_col] . "] --> "
				}

				else
				{
				DATA_SET .= A_Z[A_Z_index] . "[" . array_set[lock_row, lock_col] . "] --> "
				;~ MsgBox % row_index . "`r`n" . DATA_SET
				lock_A_Z_index := A_Z_index-1
				}

			A_Z_index++
			}
		}





		row_index := row_index + 1
	}
StringTrimRight, DATA_SET,DATA_SET,4
;~ MsgBox % DATA_SET

DATA_SET .= ";`n"


	row_index := 1
	col_index := col_index + 1
}


Clipboard := "graph TD;`n" . DATA_SET

Clipboard := RegExReplace(Clipboard, "\(", "")
Clipboard := RegExReplace(Clipboard, "\)", "")


DATA_SET := ""


ExitApp
esc::ExitApp




data_:
data =
(
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
AA
AB
AC
AD
AE
AF
AG
AH
AI
AJ
AK
AL
AM
AN
AO
AP
AQ
AR
AS
AT
AU
AV
AW
AX
AY
AZ
BA
BB
BC
BD
BE
BF
BG
BH
BI
BJ
BK
BL
BM
BN
BO
BP
BQ
BR
BS
BT
BU
BV
BW
BX
BY
BZ
CA
CB
CC
CD
CE
CF
CG
CH
CI
CJ
CK
CL
CM
CN
CO
CP
CQ
CR
CS
CT
CU
CV
CW
CX
CY
CZ
DA
DB
DC
DD
DE
DF
DG
DH
DI
DJ
DK
DL
DM
DN
DO
DP
DQ
DR
DS
DT
DU
DV
DW
DX
DY
DZ
EA
EB
EC
ED
EE
EF
EG
EH
EI
EJ
EK
EL
EM
EN
EO
EP
EQ
ER
ES
ET
EU
EV
EW
EX
EY
EZ
EZ
FA
FB
FC
FD
FE
FF
FG
FH
FI
FJ
FK
FL
FM
FN
FO
FP
FQ
FR
FS
FT
FU
FV
FW
FX
FY
FZ
GA
GB
GC
GD
GE
GF
GG
GH
GI
GJ
GK
GL
GM
GN
GO
GP
GQ
GR
GS
GT
GU
GV
GW
GX
GY
GZ
HA
HB
HC
HD
HE
HF
HG
HH
HI
HJ
HK
HL
HM
HN
HO
HP
HQ
HR
HS
HT
HU
HV
HW
HX
HY
HZ
IA
IB
IC
ID
IE
IF
IG
IH
II
IJ
IK
IL
IM
IN
IO
IP
IQ
IR
IS
IT
IU
IV
IW
IX
IY
IZ
JA
JB
JC
JD
JE
JF
JG
JH
JI
JJ
JK
JL
JM
JN
JO
JP
JQ
JR
JS
JT
JU
JV
JW
JX
JY
JZ
KA
KB
KC
KD
KE
KF
KG
KH
KI
KJ
KK
KL
KM
KN
KO
KP
KQ
KR
KS
KT
KU
KV
KW
KX
KY
KZ
)

A_Z := StrSplit(data, "`n")
A_Z_index := 1
return
heads up!
I am not an official coder.

ch.PNG
ch.PNG (20.43 KiB) Viewed 405 times
mermaid.PNG
mermaid.PNG (42.51 KiB) Viewed 405 times
pl.PNG
pl.PNG (13.88 KiB) Viewed 405 times

[Mod action: Moved topic to the v1 section since this is v1 code. The main section is now for v2.]
John ... you working ?

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 106 guests