├── README.md
├── Use mdict-utils-Gui.pdf
├── mdict.ico
└── mdictGui.au3
/README.md:
--------------------------------------------------------------------------------
1 | # Use mdict-utils-Gui
2 | mdictGui is Windows graphic user interface for mdict-utils
3 | It can be use with mdict-windows
(https://github.com/liuyug/mdict-utils)
4 | or better, with created a Python\Scripts\mdict.exe file, when install 'mdict-utils' as:
5 | python -m pip install mdict utils-py3-none-any.whl (https://pypi.org/project/mdict-utils/)
6 | in Python for Windows (https://www.python.org/downloads/)
7 | or in Portable Python for Windows (https://sourceforge.net/projects/portable-python/files/)
8 | # Create inflections or morphology dictionary for Mdict, StarDict or Kobo dictfile
9 | Download needed language Word Form https://github.com/BorisNA/wordforms
10 | and latest Python script [addflex-main](https://github.com/BorisNA/addflex)
11 | Follow the instructions https://github.com/BorisNA/addflex#introduction-to-addflex
12 | # Reference
13 | https://github.com/liuyug/mdict-utils
14 | https://github.com/zhansliu/writemdict
15 | https://github.com/BorisNA/addflex
16 | https://github.com/BorisNA/wordforms
17 |
18 |
--------------------------------------------------------------------------------
/Use mdict-utils-Gui.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jekovcar/mdict-utils-Gui/5e5791a190e39dc0b95d960a8de5404cb67c571a/Use mdict-utils-Gui.pdf
--------------------------------------------------------------------------------
/mdict.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jekovcar/mdict-utils-Gui/5e5791a190e39dc0b95d960a8de5404cb67c571a/mdict.ico
--------------------------------------------------------------------------------
/mdictGui.au3:
--------------------------------------------------------------------------------
1 | #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
2 | #AutoIt3Wrapper_Icon=mdict.ico
3 | #AutoIt3Wrapper_UseUpx=y
4 | #AutoIt3Wrapper_UseX64=n
5 | #AutoIt3Wrapper_Res_Description=mdict-utils winGui on AutoIt
6 | #AutoIt3Wrapper_Res_Fileversion=1.0.0
7 | #AutoIt3Wrapper_Res_ProductName=mdictGui
8 | #AutoIt3Wrapper_Res_ProductVersion=1.0.0
9 | #AutoIt3Wrapper_Res_CompanyName=jekovcar
10 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | MDictGUI()
20 |
21 | Func MDictGUI()
22 | $hGUI1 = GUICreate("mdictGui 1.0.0", 792, 641, 192, 125)
23 |
24 | $iButtonMdict = GUICtrlCreateButton("Mdict", 409, 64, 40, 25)
25 | GUICtrlSetTip(-1, "Select Mdict.exe")
26 | $Mdict = GUICtrlCreateEdit("", 454, 64, 244, 48, BitOR($ES_MULTILINE, $ES_READONLY))
27 | GUICtrlSetTip(-1, "Path of mdict-utils")
28 | $idButton_Descr = GUICtrlCreateButton("Descripton", 45, 64, 80, 22)
29 | $ButtonDview = GUICtrlCreateButton("View", 92, 88, 33, 20)
30 | GUICtrlSetBkColor(-1, 0xFFFBF0)
31 | GUICtrlSetTip(-1, "Edit Descripton")
32 | $ButtonDclean = GUICtrlCreateButton("Clean", 53, 88, 33, 20)
33 | GUICtrlSetState($ButtonDview, 32)
34 | GUICtrlSetState($ButtonDclean, 32)
35 | $idButton_upd = GUICtrlCreateButton("GuiUpdate", 712, 16, 60, 24)
36 | GUICtrlSetTip(-1, "GitHub mdictGui")
37 | $idButton_vers = GUICtrlCreateButton("MdictTest", 712, 86, 60, 24)
38 | GUICtrlSetTip(-1, "Test Mdict-utils & Python versions")
39 | $idButton_pypi = GUICtrlCreateButton("MdictUpd", 712, 50, 60, 24)
40 | GUICtrlSetTip(-1, "pypi.org/project/mdict-utils/")
41 | $Descr = GUICtrlCreateEdit("File Descripton", 134, 64, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
42 | $Title = GUICtrlCreateEdit("File Title", 134, 11, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
43 | $iButtonTitle = GUICtrlCreateButton("Title", 45, 12, 80, 22)
44 | $ButtonTview = GUICtrlCreateButton("View", 92, 36, 33, 20)
45 | GUICtrlSetTip(-1, "Edit Title")
46 | GUICtrlSetBkColor(-1, 0xFFFBF0)
47 | $ButtonTclean = GUICtrlCreateButton("Clean", 53, 36, 33, 20)
48 | GUICtrlSetState($ButtonTview, 32)
49 | GUICtrlSetState($ButtonTclean, 32)
50 |
51 | $GroupPackMDX = GUICtrlCreateGroup("Pack MDX / Convert TXT to Sqlite3DB", 24, 112, 393, 98)
52 | $idButton_BrowseUnp = GUICtrlCreateButton("Select MTXT", 45, 130, 80, 22)
53 | $Unp = GUICtrlCreateEdit("Source Mdict", 134, 130, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
54 | $idButton_Pack = GUICtrlCreateButton("Make MDX", 45, 181, 80, 22)
55 | $idButton_PackDir = GUICtrlCreateButton("Pack All TXT", 140, 181, 80, 22)
56 | GUICtrlSetTip(-1, "Pack MDX with all source text files")
57 | $idButton_PackDirNos = GUICtrlCreateButton("Pack All Splits", 228, 181, 80, 22)
58 | GUICtrlSetTip(-1, "Pack MDX with all source splits (PyGlossary).")
59 | $idButton_ConvSqlit = GUICtrlCreateButton("Conv TXT Sql3", 315, 181, 84, 22)
60 | GUICtrlSetTip(-1, "Convert TXT to sqlite3 DB")
61 | GUICtrlCreateGroup("", -99, -99, 1, 1)
62 |
63 | $GroupUnPackMDX = GUICtrlCreateGroup("UnPack MDX", 25, 214, 395, 104)
64 | $idButton_BrowsePack = GUICtrlCreateButton("FileMDX/MDD", 45, 230, 80, 22)
65 | $Pack = GUICtrlCreateEdit("File MDX or MDD", 134, 230, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
66 | $idButton_UnPack = GUICtrlCreateButton("Unpack MDX", 45, 258, 80, 22)
67 | $idButton_UnpMDX_DBzip = GUICtrlCreateButton("UnpFile DBzip", 136, 286, 84, 22)
68 | GUICtrlSetTip(-1, "Unpack MDX/MDD to sqlite3 DB with zip compress")
69 | $idButton_Meta = GUICtrlCreateButton("MetaInfo", 360, 286, 50, 22)
70 | GUICtrlSetTip(-1, "Meta information of MDX/MDD")
71 | $idButton_UnpMDX_DB = GUICtrlCreateButton("UnpFile DB", 45, 286, 80, 22)
72 | GUICtrlSetTip(-1, "Unpack MDX/MDD to sqlite3 DB")
73 | $idButton_UnpSplit = GUICtrlCreateButton("UnpFile Split", 227, 286, 80, 22)
74 | GUICtrlSetTip(-1, "Unpack MDX/MDD into 'az/n' parts.")
75 | $ComboSplit = GUICtrlCreateCombo("0", 312, 286, 40, 25)
76 | GUICtrlSetData(-1, "az|2|3|4|5|6|7|8|9|10")
77 | GUICtrlSetTip(-1, "Select , 2-10 parts of split")
78 | GUICtrlCreateGroup("", -99, -99, 1, 1)
79 |
80 | $GroupPackMDD = GUICtrlCreateGroup("Pack MDD", 29, 322, 393, 80)
81 | $idButton_BrowseDir = GUICtrlCreateButton("Folder MDD", 45, 340, 80, 22)
82 | $UnpMDD = GUICtrlCreateEdit("Dir MDD", 134, 342, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
83 | $idButton_PackMDD = GUICtrlCreateButton("Make MDD", 45, 369, 80, 22)
84 | GUICtrlCreateGroup("", -99, -99, 1, 1)
85 |
86 | $GroupUnPackMDD = GUICtrlCreateGroup("UnPack MDD / Convert Sqlite3DB to TXT", 30, 414, 393, 113)
87 | $idButton_BrowseMDD = GUICtrlCreateButton("Select File", 45, 440, 80, 22)
88 | $idButton_UnMDD = GUICtrlCreateButton("Unpack MDD", 45, 494, 80, 22)
89 | $PackMDD = GUICtrlCreateEdit("File MDD or DB", 134, 440, 260, 45, BitOR($ES_MULTILINE, $ES_READONLY))
90 | $idButton_UnpSqlite3 = GUICtrlCreateButton("Conv Sql3 TXT", 315, 494, 84, 22)
91 | GUICtrlSetTip(-1, "Convert sqlite3 DB to TXT")
92 | GUICtrlCreateGroup("", -99, -99, 1, 1)
93 |
94 | $GroupQuery = GUICtrlCreateGroup("Search in MDX dict", 30, 530, 393, 89)
95 | $idButton_key = GUICtrlCreateButton("Query key", 45, 556, 80, 22)
96 | $inp_word = GUICtrlCreateInput("", 134, 556, 260, 21)
97 | GUICtrlSetTip(-1, "Only used to test whether dictionary packaging is correct.%CRLF%??????????????")
98 | GUICtrlCreateLabel("Enter to request the key. Empty for all key list", 134, 582, 282, 20)
99 | GUICtrlCreateGroup("", -99, -99, 1, 1)
100 |
101 | GUICtrlCreateLabel("MORPHOLOGY ,", 510, 144, 268, 17)
102 | GUICtrlSetTip(-1, "Section Generate for Mdict , StarDict Kobo dictfile")
103 |
104 | GUICtrlCreateLabel("MORPHOLOGY , INFLECTIONS ( HOMONYMS )", 510, 144, 268, 17)
105 | GUICtrlSetTip(-1, "Section Generate for Mdict , StarDict & Kobo dictfile")
106 |
107 | $GroupKobo = GUICtrlCreateGroup("Kobo dict", 480, 168, 285, 97)
108 | $iButtonInfoFlex = GUICtrlCreateButton("Info addFlex", 678, 182, 74, 25)
109 | GUICtrlSetTip(-1, "Introduction for Inflection")
110 | $kobo = GUICtrlCreateEdit("Kobo df", 492, 222, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
111 | GUICtrlSetTip(-1, "Path of Kobo dictfile")
112 | $iButtonKobo = GUICtrlCreateButton("Kobo", 494, 189, 40, 25)
113 | GUICtrlSetTip(-1, "Select Kobo dictfile")
114 | GUICtrlCreateGroup("", -99, -99, 1, 1)
115 |
116 | $GroupInflex = GUICtrlCreateGroup("Generate Inflection", 440, 282, 325, 242)
117 | $iButtonPython = GUICtrlCreateButton("Python", 446, 300, 40, 25)
118 | GUICtrlSetTip(-1, "Select Python.exe installed(Portable)")
119 | $Pyth = GUICtrlCreateEdit("Python exe", 492, 300, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
120 | GUICtrlSetTip(-1, "Path of Python.exe installed(Portable)")
121 | $iButton_flexpy = GUICtrlCreateButton("FlexPy", 446, 360, 40, 25)
122 | GUICtrlSetTip(-1, "Select addflex-main Python scrip")
123 | $flexpy = GUICtrlCreateEdit("addflex_mdx py -> for Mdict" & @CRLF & "addflex_df py -> for Kobo dict", 492, 361, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
124 | GUICtrlSetTip(-1, "Download it from github.com/BorisNA/addflex")
125 | $iButtonForm = GUICtrlCreateButton("Forms", 446, 405, 40, 26)
126 | GUICtrlSetTip(-1, "Select wordforms")
127 | $WordForm = GUICtrlCreateEdit("Forms txt", 492, 406, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
128 | GUICtrlSetTip(-1, "Download it from github.com/BorisNA/wordforms")
129 | $iButtonConvFlex = GUICtrlCreateButton("Convert Flex", 682, 442, 70, 25)
130 | GUICtrlSetTip(-1, "Generate inflection")
131 | $ComboInflex = GUICtrlCreateCombo("Standalone inflection", 526, 444, 140, 26)
132 | GUICtrlSetData(-1, "Standalone inflection|Morphological dictionary|Kobo dictionary")
133 | GUICtrlSetTip(-1, "Select , a target dictionary to generate")
134 | $iButtonFscript = GUICtrlCreateButton("FScript", 446, 464, 42, 26)
135 | GUICtrlSetTip(-1, "Select check_wordforms script")
136 | $iButtonCheck = GUICtrlCreateButton("Check", 446, 494, 42, 22)
137 | GUICtrlSetTip(-1, "It's recommended to Check Forms before converting")
138 | $FScript = GUICtrlCreateEdit("wordform script py", 494, 478, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
139 | GUICtrlSetTip(-1, "Download it from github.com/BorisNA/wordforms")
140 | GUICtrlCreateGroup("", -99, -99, 1, 1)
141 |
142 | $GroupConca = GUICtrlCreateGroup("Concatenate Morph dict + source Mdict", 440, 530, 325, 92)
143 | $iButtonMorph = GUICtrlCreateButton("Morphо", 446, 550, 42, 26)
144 | GUICtrlSetTip(-1, "Select Generated Morphological dictionary")
145 | $Morph = GUICtrlCreateEdit("Morphological txt", 494, 550, 260, 32, BitOR($ES_MULTILINE, $ES_READONLY))
146 | GUICtrlSetTip(-1, "Path of generated 'Morphological dictionary'")
147 | $iButtonConca = GUICtrlCreateButton("Concatenate", 676, 588, 73, 25)
148 | GUICtrlSetTip(-1, "Concatenate 'Morphological dictionary' with Selected 'Source Mdict'")
149 | GUICtrlCreateGroup("", -99, -99, 1, 1)
150 |
151 | GUICtrlCreateLabel("All files must be UTF-8 encoding, include HTML and TXT", 65, 610, 350, 20)
152 | GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
153 | GUICtrlSetColor(-1, 0x0000FF)
154 |
155 | GUISetState(@SW_SHOW)
156 | Local $iPIDPack = 0
157 | Local $iPIDUnPack = 0
158 | Local $iPIDPackMDD = 0
159 | Local $iPIDUnMDD = 0
160 | Local $iPIDMeta = 0
161 | Local $iPIDversPyth = 0
162 | Local $iPIDversMdict = 0
163 | Local $iPIDconv_db = 0
164 | Local $iPIDUn_db = 0
165 | Local $iPIDPack_all = 0
166 | Local $iPIDUnPack_db = 0
167 | Local $iPIDUnPack_zip = 0
168 | Local $iPIDUnPackSplit = 0
169 | Local $iPIDquery = 0
170 | Local $iPIDConvFlex = 0
171 | Local $iPIDconcat = 0
172 | Local $iPIDfscript = 0
173 | Local $sDesc = 0
174 | Local $sTit = 0
175 | Local $sUnp = 0
176 | Local $sPack = 0
177 | Local $sUnMDD = 0
178 | Local $sPackMDD = 0
179 | Local $sForms = 0
180 | Local $sMorph = 0
181 | Local $skob = 0
182 | Local $kobo_ = 0
183 | Local $Pack_ = ""
184 | Local $sExt2 = ""
185 | Local $sExt3 = ""
186 |
187 | ; Display the GUI
188 | GUISetState(@SW_SHOW, $hGUI1)
189 |
190 | ; Initialize a Local RUN script.
191 | Local $aMsg = 0
192 | RunWait(@ComSpec & " /c %SystemDrive%&&cd %temp%&&echo %cd%>temp.tmp", "", @SW_HIDE) ; create temp file to save %cd%
193 | $file = FileOpen(@TempDir & "\temp.tmp", 0)
194 | $line = FileReadLine($file)
195 | ; Read from INI.
196 | GUICtrlSetData($Pyth, IniRead($line & "\mdictGui_.ini", "Python", "PythonPath", ""))
197 | GUICtrlSetData($Mdict, IniRead($line & "\mdictGui_.ini", "Mdict", "MdictPath", ""))
198 | GUICtrlSetData($flexpy, IniRead($line & "\mdictGui_.ini", "Addflex", "addflexpy", ""))
199 | GUICtrlSetData($FScript, IniRead($line & "\mdictGui_.ini", "FScript", "FScriptpath", ""))
200 |
201 | ;-------------Label--addflex script
202 | If StringInStr(GUICtrlRead($flexpy), "addflex_mdx.py") > 0 Then
203 | GUICtrlCreateLabel(" Selected 'addflex_mdx py' -> Mdict", 500, 344, 240, 17)
204 | GUICtrlSetBkColor(-1, 0xFFFFFF)
205 | GUICtrlSetData($ComboInflex, "Standalone inflection")
206 | ElseIf StringInStr(GUICtrlRead($flexpy), "addflex_df.py") > 0 Then
207 | GUICtrlCreateLabel(" Selected 'addflex_df py' -> Kobo df", 500, 344, 240, 17)
208 | GUICtrlSetBkColor(-1, 0xFFFFFF)
209 | GUICtrlSetData($ComboInflex, "Kobo dictionary")
210 | Else
211 | GUICtrlCreateLabel("addflex_mdx py -> Mdict ; addflex_df py -> Kobo df", 500, 344, 240, 17)
212 | EndIf
213 | ;------------------------------
214 | ; Check file path for spaces.
215 | If StringInStr($line, " ") > 0 Then MsgBox(0, "", "There is a space in the 'мdict' path and it may not work properly.")
216 | ;------------------------------
217 |
218 | ; Display a message of whether the file Mdict path exists
219 | If FileOpen(GUICtrlRead($Mdict)) = -1 Then
220 | If MsgBox(262209, "Check Mdict-utils", "'mdict.exe' doesn't exist. Mdict section won't work." & @CRLF & @CRLF & _
221 | "Pls visit, " & "github/liuyug/mdict-utils" & @CRLF & _
222 | "to download last 'mdict-windows'.") = 1 Then ShellExecute("https://github.com/liuyug/mdict-utils/releases")
223 | GUICtrlCreateLabel("'mdict-utils' does not exist. Mdict section won't work >", 108, 160, 309, 20)
224 | GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
225 | GUICtrlSetBkColor(-1, 0xFFFF00)
226 | GUICtrlCreateLabel(" B"& @CRLF &" r"& @CRLF &" o"& @CRLF &" w"& @CRLF &" s"& @CRLF &" e", 418, 94, 18, 96)
227 | GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
228 | GUICtrlSetBkColor(-1, 0xFFFF00)
229 | Else
230 | EndIf
231 | FileClose(GUICtrlRead($Mdict))
232 |
233 | Local $msg = 0
234 | While $msg <> $GUI_EVENT_CLOSE
235 | $msg = GUIGetMsg()
236 |
237 | ; Select File Descr----------------------------1
238 | Select
239 | Case $msg = $idButton_Descr
240 | $sMessageDescr = "Please select a description file."
241 | $Descr1 = FileOpenDialog($sMessageDescr, @DesktopDir & "\", "Description File (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
242 | If @error Then
243 | Else
244 | $Descr1 = StringReplace($Descr1, "|", @CRLF)
245 | ; Check file is encoding of UTF
246 | Local $iEncoding = FileGetEncoding($Descr1) ; Retrieve the file encoding of the current script.
247 | If @error Then
248 | MsgBox(8192, "", "Error: Could not obtain the file encoding.")
249 | ElseIf Not ($iEncoding = 256) + ($iEncoding = 128) Then
250 | If MsgBox(1, "File Description", "Selected Description is not UTF 8 :" & @CRLF & $Descr1 & @CRLF _
251 | & @CRLF & "Do you want to edit (save in UTF-8) it in 'Notepad' ?") = 1 Then
252 | Run("notepad.exe " & $Descr1, @WindowsDir, @SW_SHOWNORMAL)
253 | EndIf
254 | Else
255 | If FileGetSize($Descr1) > 2048 Then
256 | If MsgBox(257, "File Description", "Selected file : " & $Descr1 & @CRLF & @CRLF _
257 | & "is too large for 'Description', recommended size <2 KB" & @CRLF _
258 | & "OK to edit it in 'Notepad' or continue with selected ?") = 1 Then
259 | Run("notepad.exe " & $Descr1, @WindowsDir, @SW_SHOWNORMAL)
260 | Else
261 | $sDesc = 1
262 | GUICtrlSetData($Descr, $Descr1)
263 | GUICtrlSetState($ButtonDview, 16)
264 | GUICtrlSetState($ButtonDclean, 16)
265 | EndIf
266 | Else
267 | $sDesc = 1
268 | GUICtrlSetData($Descr, $Descr1)
269 | GUICtrlSetState($ButtonDview, 16)
270 | GUICtrlSetState($ButtonDclean, 16)
271 | EndIf
272 | EndIf
273 | ; Check file path for spaces.
274 | If StringInStr($Descr1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
275 | ;----------------------
276 | EndIf
277 | EndSelect
278 |
279 | ; Select Open Mdict source MTXT-----------------2
280 | Select
281 | Case $msg = $idButton_BrowseUnp
282 | $sMessageUnp = "Please select your Mdict source file."
283 | $Unp1 = FileOpenDialog($sMessageUnp, @DesktopDir & "\", "Mdict source (*.txt;*.mtxt)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
284 | If @error Then
285 | Else
286 | $Unp1 = StringReplace($Unp1, "|", @CRLF)
287 | $Un_ = _WinAPI_PathRemoveExtension($Unp1)
288 | $Un_ = _WinAPI_PathRemoveExtension($Un_)
289 | $sUnp = 1
290 | GUICtrlSetData($Unp, $Unp1)
291 | Local $UnpDir = StringRegExpReplace($Unp1, "\\[^\\]+$", "")
292 | ; Check file path for spaces.
293 | If StringInStr($Unp1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
294 | ;----------------------
295 | EndIf
296 | EndSelect
297 |
298 | ; Select Open MDX/MDD-------------------------------3
299 | Select
300 | Case $msg = $idButton_BrowsePack
301 | $sMessagePack = "Please select an MDX/MDD file."
302 | $Pack1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "Mdict file (*.mdx;*.mdd)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
303 | If @error Then
304 | Else
305 | $Pack1 = StringReplace($Pack1, "|", @CRLF)
306 | $sPack = 1
307 | GUICtrlSetData($Pack, $Pack1)
308 | $sExt3 = StringRegExpReplace($Pack1, "^.*\.", "")
309 | ; Check file path for spaces.
310 | If StringInStr($Pack1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
311 | ;----------------------
312 | EndIf
313 | EndSelect
314 |
315 | ; Select Button_Pack MDX----------------------------4
316 | Select
317 | Case $msg = $idButton_Pack
318 | If $sUnp = 0 Then
319 | MsgBox(8192, "", "You are not chosen Mdict source")
320 | Else
321 | If $sTit = 0 Then
322 | If $sDesc = 0 Then
323 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF & GUICtrlRead($Unp) & @CRLF & _
324 | "will be pack without Description as:" & @CRLF & $Un_ & ".mdx") = 1 Then
325 | $iPIDPack = Run(GUICtrlRead($Mdict) & " -a " & GUICtrlRead($Unp) & " " & $Un_ & ".mdx", "", @SW_SHOWNORMAL)
326 | $sPack = 1
327 | GUICtrlSetData($Pack, $Un_ & ".mdx")
328 | EndIf
329 | Else
330 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF _
331 | & GUICtrlRead($Unp) & @CRLF & "will be pack as:" & @CRLF & $Un_ & ".mdx") = 1 Then
332 | $iPIDPack = Run(GUICtrlRead($Mdict) & " --description " & GUICtrlRead($Descr) & " -a " & GUICtrlRead($Unp) & " " & $Un_ & ".mdx", "", @SW_SHOWNORMAL)
333 | $sPack = 1
334 | GUICtrlSetData($Pack, $Un_ & ".mdx")
335 | EndIf
336 | EndIf
337 | Else
338 | If $sDesc = 0 Then
339 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF & GUICtrlRead($Unp) & @CRLF & _
340 | "with Title will be pack without Description as:" & @CRLF & $Un_ & ".mdx") = 1 Then
341 | $iPIDPack = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " -a " & GUICtrlRead($Unp) & " " & $Un_ & ".mdx", "", @SW_SHOWNORMAL)
342 | $sPack = 1
343 | GUICtrlSetData($Pack, $Un_ & ".mdx")
344 | EndIf
345 | Else
346 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF _
347 | & GUICtrlRead($Unp) & @CRLF & "with Title will be pack as:" & @CRLF & $Un_ & ".mdx") = 1 Then
348 | $iPIDPack = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " --description " & GUICtrlRead($Descr) & " -a " & GUICtrlRead($Unp) & " " & $Un_ & ".mdx", "", @SW_SHOWNORMAL)
349 | $sPack = 1
350 | GUICtrlSetData($Pack, $Un_ & ".mdx")
351 | EndIf
352 | EndIf
353 | EndIf
354 | EndIf
355 | EndSelect
356 |
357 | ; Select Button_UnPack MDX --------------------------5
358 | Select
359 | Case $msg = $idButton_UnPack
360 | If $sPack = 0 Or $sExt3 = "mdd" Then
361 | MsgBox(8192, "", "You are not chosen MDX file")
362 | Else
363 | If MsgBox(1, "Your choice", "You choose MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF & "will be unpack in dir: MDX") = 1 Then
364 | $iPIDUnPack = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($Pack) & " -d ./mdx", "", @SW_SHOWNORMAL)
365 | EndIf
366 | EndIf
367 | EndSelect
368 |
369 | ; Select Button_Metainfo-----------------------------6
370 | Select
371 | Case $msg = $idButton_Meta
372 | If $sPack = 0 Then
373 | MsgBox(8192, "", "You are not chosen MDX/MDD file")
374 | Else
375 | $iPIDMeta = Run(@ComSpec & " /k " & GUICtrlRead($Mdict) & " -m " & GUICtrlRead($Pack) & "", "", @SW_SHOWNORMAL)
376 | EndIf
377 | EndSelect
378 |
379 | ; Select Button_Mdict_version------------------------7
380 | Select
381 | Case $msg = $idButton_vers
382 | If GUICtrlRead($Pyth) = "" Then
383 | $iPIDversMdict = Run(@ComSpec & " /k " & GUICtrlRead($Mdict) & " --version", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
384 | Else
385 | $iPIDversMdict = Run(@ComSpec & " /k " & GUICtrlRead($Mdict) & " --version", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
386 | $iPIDversPyth = Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " --version", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
387 | Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " -m pip list", "", @SW_SHOWNORMAL)
388 | EndIf
389 | Global $ResponsePyth, $ResponseMdict
390 | While 1
391 | If GUICtrlRead($Mdict) = "" Then
392 | $ResponsePyth &= StdoutRead($iPIDversPyth)
393 | ;$ResponseMdict &= StdoutRead($iPIDversMdict)
394 | Else
395 | $ResponsePyth &= StdoutRead($iPIDversPyth)
396 | $ResponseMdict &= StdoutRead($iPIDversMdict)
397 | EndIf
398 | If @error Then ExitLoop
399 | WEnd
400 | $ResponseMdict = StringReplace($ResponseMdict, @WorkingDir & ">", "")
401 | $ResponsePyth = StringReplace($ResponsePyth, @WorkingDir & ">", "")
402 | MsgBox(0, "Test Mdict Version", "Mdict ===> " & $ResponseMdict & @CRLF & "Python ==> " & $ResponsePyth)
403 | Global $ResponsePyth = "", $ResponseMdict = ""
404 | EndSelect
405 |
406 | ; Select Folder MDD----------------------------------8
407 | Select
408 | Case $msg = $idButton_BrowseDir
409 | $sMessageUnpMDD = "Please select your Mdd folder."
410 | $UnpMDD1 = FileSelectFolder($sMessageUnpMDD, "")
411 | If @error Then
412 | Else
413 | $sUnMDD = 1
414 | GUICtrlSetData($UnpMDD, $UnpMDD1)
415 | ; Check file path for spaces.
416 | If StringInStr($UnpMDD1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'folder' path and it may not work properly.")
417 | ;----------------------
418 | EndIf
419 | EndSelect
420 |
421 | ; Select Open MDD file----------------------------------9
422 | Select
423 | Case $msg = $idButton_BrowseMDD
424 | $sMessagePackMDD = "Please select an MDD/DB file."
425 | $PackMDD1 = FileOpenDialog($sMessagePackMDD, @DesktopDir & "\", "Open file (*.mdd;*.db)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
426 | If @error Then
427 | Else
428 | $PackMDD1 = StringReplace($PackMDD1, "|", @CRLF)
429 | $sPackMDD = 1
430 | GUICtrlSetData($PackMDD, $PackMDD1)
431 | $sExt2 = StringRegExpReplace($PackMDD1, "^.*\.", "")
432 | ; Check file path for spaces.
433 | If StringInStr($PackMDD1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
434 | ;----------------------
435 | EndIf
436 | EndSelect
437 |
438 | ; Select Button_Pack MDD--------------------------------10
439 | Select
440 | Case $msg = $idButton_PackMDD
441 | If $sUnMDD = 0 Then
442 | MsgBox(8192, "", "You are not chosen MDD source")
443 | Else
444 | If $sTit = 0 Then
445 | If $sDesc = 0 Then
446 | If MsgBox(1, "Your choice", "You choose MDD source:" & @CRLF & "" & GUICtrlRead($UnpMDD) & "" & @CRLF _
447 | & "will be pack without Description as:" & @CRLF & GUICtrlRead($UnpMDD) & ".mdd") = 1 Then
448 | $iPIDPackMDD = Run(GUICtrlRead($Mdict) & " -a " & GUICtrlRead($UnpMDD) & " " & GUICtrlRead($UnpMDD) & ".mdd", "", @SW_SHOWNORMAL)
449 | EndIf
450 | Else
451 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF & "" & GUICtrlRead($UnpMDD) & "" & @CRLF & "will be pack as:" & @CRLF & GUICtrlRead($UnpMDD) & ".mdd") = 1 Then
452 | $iPIDPackMDD = Run(GUICtrlRead($Mdict) & " --description " & GUICtrlRead($Descr) & " -a " & GUICtrlRead($UnpMDD) & " " & GUICtrlRead($UnpMDD) & ".mdd", "", @SW_SHOWNORMAL)
453 | EndIf
454 | EndIf
455 | Else
456 | If $sDesc = 0 Then
457 | If MsgBox(1, "Your choice", "You choose MDD source:" & @CRLF & "" & GUICtrlRead($UnpMDD) & "" & @CRLF _
458 | & "with Title will be pack without Description as:" & @CRLF & GUICtrlRead($UnpMDD) & ".mdd") = 1 Then
459 | $iPIDPackMDD = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " -a " & GUICtrlRead($UnpMDD) & " " & GUICtrlRead($UnpMDD) & ".mdd", "", @SW_SHOWNORMAL)
460 | EndIf
461 | Else
462 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF & "" & GUICtrlRead($UnpMDD) & "" & @CRLF & "with Title will be pack as:" & @CRLF & GUICtrlRead($UnpMDD) & ".mdd") = 1 Then
463 | $iPIDPackMDD = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " --description " & GUICtrlRead($Descr) & " -a " & GUICtrlRead($UnpMDD) & " " & GUICtrlRead($UnpMDD) & ".mdd", "", @SW_SHOWNORMAL)
464 | EndIf
465 | EndIf
466 | EndIf
467 | EndIf
468 | EndSelect
469 |
470 | ; Select Button_UnPack MDD-------------------------------11
471 | Select
472 | Case $msg = $idButton_UnMDD
473 | If $sPackMDD = 0 Or $sExt2 = "db" Then
474 | MsgBox(8192, "", "You are not chosen MDD file")
475 | Else
476 | If MsgBox(1, "Your choice", "You choose MDD file:" & @CRLF & "" & GUICtrlRead($PackMDD) & "" & @CRLF & "will be unpack in dir: MDD") = 1 Then
477 | $iPIDUnMDD = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($PackMDD) & " -d ./mdd", "", @SW_SHOWNORMAL)
478 | EndIf
479 | EndIf
480 | EndSelect
481 |
482 | ; Select Button_UnPackMDD to Sqlite3-db------------------12
483 | Select
484 | Case $msg = $idButton_UnpSqlite3
485 | If $sPackMDD = 0 Or $sExt2 = "mdd" Then
486 | MsgBox(8192, "", "You are not chosen db file")
487 | Else
488 | If MsgBox(1, "Your choice", "You choose Sqlite3 db file:" & @CRLF _
489 | & "" & GUICtrlRead($PackMDD) & "" & @CRLF & "will be unpack as:" & GUICtrlRead($PackMDD) & ".txt") = 1 Then
490 | $iPIDUn_db = Run(GUICtrlRead($Mdict) & " --db-txt " & GUICtrlRead($PackMDD) & "", "", @SW_SHOWNORMAL)
491 | EndIf
492 | EndIf
493 | EndSelect
494 |
495 | ; Select Button_Conv TXT Sql3----------------------------13
496 | Select
497 | Case $msg = $idButton_ConvSqlit
498 | If $sUnp = 0 Then
499 | MsgBox(8192, "", "You are not chosen Mdict source")
500 | Else
501 | If MsgBox(1, "Your choice", "You choose Mdict source:" & @CRLF & "" & GUICtrlRead($Unp) & "" & @CRLF & "will be convert as:" & GUICtrlRead($Unp) & ".db") = 1 Then
502 | $iPIDconv_db = Run(GUICtrlRead($Mdict) & " --txt-db " & GUICtrlRead($Unp) & "", "", @SW_SHOWNORMAL)
503 | EndIf
504 | EndIf
505 | EndSelect
506 |
507 | ; Select Button_Pack All TXT----------------------------14
508 | Select
509 | Case $msg = $idButton_PackDir
510 | If $sUnp = 0 Then
511 | MsgBox(8192, "", "You are not chosen at last one Mdict source")
512 | Else
513 | If $sTit = 0 Then
514 | If $sDesc = 0 Then
515 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
516 | & "all TXT will be pack without Description as :" & @CRLF & $UnpDir & "\Alldict.mdx") = 1 Then
517 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " -a " & $UnpDir & " " & $UnpDir & "\Alldict.mdx", "", @SW_SHOWNORMAL)
518 | EndIf
519 | Else
520 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
521 | & "all TXT will be pack as :" & @CRLF & $UnpDir & "\Alldict_descr.mdx") = 1 Then
522 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --description " & GUICtrlRead($Descr) & " -a " & $UnpDir & " " & $UnpDir & "\Alldict_descr.mdx", "", @SW_SHOWNORMAL)
523 | EndIf
524 | EndIf
525 | Else
526 | If $sDesc = 0 Then
527 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
528 | & "with Title all TXT will be pack without Description as :" & @CRLF & $UnpDir & "\Alldict_title.mdx") = 1 Then
529 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " -a " & $UnpDir & " " & $UnpDir & "\Alldict_title.mdx", "", @SW_SHOWNORMAL)
530 | EndIf
531 | Else
532 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
533 | & "with Title all TXT will be pack as :" & @CRLF & $UnpDir & "\Alldict_title_descr.mdx") = 1 Then
534 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " --description " & GUICtrlRead($Descr) & " -a " & $UnpDir & " " & $UnpDir & "\Alldict_title_descr.mdx", "", @SW_SHOWNORMAL)
535 | EndIf
536 | EndIf
537 | EndIf
538 | EndIf
539 | EndSelect
540 |
541 | ; Select Button_Pack All splits----------------------------15
542 | Select
543 | Case $msg = $idButton_PackDirNos
544 | If $sUnp = 0 Then
545 | MsgBox(8192, "", "You are not chosen at last one Mdict source")
546 | Else
547 | ;=======================================
548 | Local $FileDir = StringRegExpReplace($Un_, "\\[^\\]*$", "")
549 | Local $FileName = StringRegExpReplace($Un_, "^.*\\", "")
550 | Global $sPathToFiles = $FileDir & "\"
551 | If MsgBox(1, "Your choice", "Wont to rename all '" & $FileName & "' source splits in dir:" & @CRLF & "" & $sPathToFiles & "" & @CRLF _
552 | & "with numbers, for the action 'Pack All Splits'" & @CRLF & @CRLF & "Note. The Name & Description files should not be in the dir:" & @CRLF & "" & $sPathToFiles & "") = 1 Then
553 | Global $newFileName = 0, $aFilesToRename = ""
554 | $aFilesToRename = _FileListToArray($sPathToFiles, "*.??", 1)
555 | For $i = 1 To $aFilesToRename[0]
556 | $newFileName += 1
557 | FileMove($sPathToFiles & $aFilesToRename[$i], $sPathToFiles & $FileName & "." & String($newFileName) & ".txt", 0)
558 | Next
559 | ;=======================================
560 | If $sTit = 0 Then
561 | If $sDesc = 0 Then
562 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
563 | & "all TXT will be pack without Description as :" & @CRLF & $UnpDir & "\Allsplit.mdx") = 1 Then
564 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " -a " & $UnpDir & " " & $UnpDir & "\Allsplit.mdx", "", @SW_SHOWNORMAL)
565 | EndIf
566 | Else
567 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
568 | & "all TXT will be pack as :" & @CRLF & $UnpDir & "\Allsplit_descr.mdx") = 1 Then
569 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --description " & GUICtrlRead($Descr) & " -a " & $UnpDir & " " & $UnpDir & "\Allsplit_descr.mdx", "", @SW_SHOWNORMAL)
570 | EndIf
571 | EndIf
572 | Else
573 | If $sDesc = 0 Then
574 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
575 | & "with Title all TXT will be pack without Description as :" & @CRLF & $UnpDir & "\Allsplit_title.mdx") = 1 Then
576 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " -a " & $UnpDir & " " & $UnpDir & "\Allsplit_title.mdx", "", @SW_SHOWNORMAL)
577 | EndIf
578 | Else
579 | If MsgBox(1, "Your choice", "In selected Mdict Folder :" & @CRLF & "" & $UnpDir & "" & @CRLF _
580 | & "with Title all TXT will be pack as :" & @CRLF & $UnpDir & "\Allsplit_title_descr.mdx") = 1 Then
581 | $iPIDPack_all = Run(GUICtrlRead($Mdict) & " --title " & GUICtrlRead($Title) & " --description " & GUICtrlRead($Descr) & " -a " & $UnpDir & " " & $UnpDir & "\Allsplit_title_descr.mdx", "", @SW_SHOWNORMAL)
582 | EndIf
583 | EndIf
584 | EndIf
585 | EndIf
586 | EndIf
587 |
588 | EndSelect
589 |
590 | ; Select Button_UnPackMDX/MDD to DB-------------------------16
591 | Select
592 | Case $msg = $idButton_UnpMDX_DB
593 | If $sPack = 0 Then
594 | MsgBox(8192, "", "You are not chosen MDX/MDD file")
595 | Else
596 | $Pack_ = _WinAPI_PathRemoveExtension($Pack1)
597 | $Pack_ = _WinAPI_PathRemoveExtension($Pack_)
598 | If $sExt3 = "mdx" Then
599 | If MsgBox(1, "Your choice", "You choosed MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF & @CRLF & "is packing as :" & @CRLF & GUICtrlRead($Pack) & ".mdx.db") = 1 Then
600 | FileCopy(GUICtrlRead($Pack), $Pack_ & ".mdx.mdx", $FC_OVERWRITE)
601 | $iPIDUnPack_zip = Run(GUICtrlRead($Mdict) & " -x " & $Pack_ & ".mdx.mdx --exdb", "", @SW_SHOWNORMAL)
602 | MsgBox(8192, "Waiting for the end of Mdict", "!Pls,wait while MDX unpacks into a db!")
603 | FileDelete($Pack_ & ".mdx.mdx")
604 | EndIf
605 | Else
606 | If MsgBox(1, "Your choice", "You choosed MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF _
607 | & @CRLF & "is packing as :" & @CRLF & $Pack_ & ".mdd.db") = 1 Then
608 | FileCopy(GUICtrlRead($Pack), $Pack_ & ".mdd.mdd", $FC_OVERWRITE)
609 | $iPIDUnPack_zip = Run(GUICtrlRead($Mdict) & " -x " & $Pack_ & ".mdd.mdd --exdb", "", @SW_SHOWNORMAL)
610 | MsgBox(8192, "Waiting for the end of Mdict", "!Pls,wait while MDD unpacks into a db!")
611 | FileDelete($Pack_ & ".mdd.mdd")
612 | EndIf
613 | EndIf
614 | EndIf
615 | EndSelect
616 |
617 | ; Select Button_UnPackMDX/MDD to DBzip-----------------------17
618 | Select
619 | Case $msg = $idButton_UnpMDX_DBzip
620 | If $sPack = 0 Then
621 | MsgBox(4096, "", "You are not chosen MDX/MDD file")
622 | Else
623 | $Pack_ = _WinAPI_PathRemoveExtension($Pack1)
624 | $Pack_ = _WinAPI_PathRemoveExtension($Pack_)
625 | If $sExt3 = "mdx" Then
626 | If MsgBox(1, "Your choice", "You choosed MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF _
627 | & @CRLF & "is packing as compressed:" & @CRLF & $Pack_ & ".mdx_zip.db") = 1 Then
628 | FileCopy(GUICtrlRead($Pack), $Pack_ & ".mdx_zip.mdx", $FC_OVERWRITE)
629 | $iPIDUnPack_zip = Run(GUICtrlRead($Mdict) & " -x " & $Pack_ & ".mdx_zip.mdx --exdb-zip", "", @SW_SHOWNORMAL)
630 | MsgBox(8192, "Waiting for the end of Mdict", "!Pls,wait while MDX unpacks into a db zip!")
631 | FileDelete($Pack_ & ".mdx_zip.mdx")
632 | EndIf
633 | Else
634 | If MsgBox(1, "Your choice", "You choosed MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF _
635 | & @CRLF & "is packing as compressed:" & @CRLF & $Pack_ & ".mdd_zip.db") = 1 Then
636 | FileCopy(GUICtrlRead($Pack), $Pack_ & ".mdd_zip.mdd", $FC_OVERWRITE)
637 | $iPIDUnPack_zip = Run(GUICtrlRead($Mdict) & " -x " & $Pack_ & ".mdd_zip.mdd --exdb-zip", "", @SW_SHOWNORMAL)
638 | MsgBox(8192, "Waiting for the end of Mdict", "!Pls,wait while MDD unpacks into a db zip!")
639 | FileDelete($Pack_ & ".mdd_zip.mdd")
640 | EndIf
641 | EndIf
642 | EndIf
643 | EndSelect
644 |
645 | ; Select Choise Combo Split Parts----------------------------18
646 | Select
647 | Case $msg = $ComboSplit
648 | $sComboRead = GUICtrlRead($ComboSplit)
649 | EndSelect
650 |
651 | ; Select Button_UnPack MDX/MDD to Splits---------------------19
652 | Select
653 | Case $msg = $idButton_UnpSplit
654 | If $sPack = 0 Then
655 | MsgBox(8192, "", "You are not chosen MDX/MDD file")
656 | Else
657 | $sComboRead = GUICtrlRead($ComboSplit)
658 | If $sComboRead = "0" Then
659 | MsgBox(8192, "", "You are not chosen Splits: " & $sComboRead)
660 | Else
661 | If $sExt3 = "mdx" Then
662 | If MsgBox(1, "Your choice", "You choose MDX file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF _
663 | & "will be unpacked into " & $sComboRead & " parts in dir : " & $sExt3) = 1 Then
664 | If $sComboRead = "az" Then
665 | $iPIDUnPackSplit = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($Pack) & " -d ./mdx --split-" & $sComboRead & "", "", @SW_SHOWNORMAL)
666 | Else
667 | $iPIDUnPackSplit = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($Pack) & " -d ./mdx --split-n " & $sComboRead & "", "", @SW_SHOWNORMAL)
668 | EndIf
669 | EndIf
670 | ElseIf $sExt3 = "mdd" Then
671 | If MsgBox(1, "Your choice", "You choose MDD file:" & @CRLF & "" & GUICtrlRead($Pack) & "" & @CRLF _
672 | & "will be unpacked into " & $sComboRead & " parts in dir : " & $sExt3) = 1 Then
673 | If $sComboRead = "az" Then
674 | $iPIDUnPackSplit = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($Pack) & " -d ./mdd --split-" & $sComboRead & "", "", @SW_SHOWNORMAL)
675 | Else
676 | $iPIDUnPackSplit = Run(GUICtrlRead($Mdict) & " -x " & GUICtrlRead($Pack) & " -d ./mdd --split-n " & $sComboRead & "", "", @SW_SHOWNORMAL)
677 | EndIf
678 | EndIf
679 | EndIf
680 | EndIf
681 | EndIf
682 | EndSelect
683 |
684 | ; Select Button GuiUpdate------------------------------------20
685 | Select
686 | Case $msg = $idButton_upd
687 | If MsgBox(1, "Check the latest mdictGui releases", "Want to check the GitHub repository" & @CRLF & _
688 | "for the latest mdictGui releases?") = 1 Then ShellExecute("https://github.com/jekovcar/mdict-utils-Gui/releases")
689 | EndSelect
690 |
691 | ; Select Button mdict Pypi-------------------------------21
692 | Select
693 | Case $msg = $idButton_pypi
694 | If MsgBox(1, "Check the latest mdict-utils", "Want to check Project mdict-utils" & @CRLF & _
695 | "on Pypi.Org for the latest releases?") = 1 Then ShellExecute("https://pypi.org/project/mdict-utils/")
696 | EndSelect
697 |
698 | ; Select button Query key--------------------------------22
699 | Select
700 | Case $msg = $idButton_key
701 | $inp = GUICtrlRead($inp_word)
702 | If $sPack = 0 Or $sExt3 = "mdd" Then
703 | MsgBox(8192, "", "You are not chosen MDX file")
704 | Else
705 | If $inp = "" Then
706 | If MsgBox(1, "Your choice", "Typed word is EMPTY." & @CRLF & @CRLF & "Mdict will All key list ?") = 1 Then
707 | $iPIDquery = Run(@ComSpec & " /k " & GUICtrlRead($Mdict) & " -k " & GUICtrlRead($Pack) & "", "", @SW_SHOWNORMAL)
708 | EndIf
709 | Else
710 | If MsgBox(1, "Your choice", "Query word <" & $inp & "> in :" & @CRLF & @CRLF & GUICtrlRead($Pack) & " ?") = 1 Then
711 | $iPIDquery = Run(@ComSpec & " /k " & GUICtrlRead($Mdict) & " -q " & $inp & " " & GUICtrlRead($Pack) & "", "", @SW_SHOWNORMAL)
712 | EndIf
713 | EndIf
714 | EndIf
715 | EndSelect
716 |
717 | ; Select path of PYTHON ------------------------------23
718 | Select
719 | Case $msg = $iButtonPython
720 | $sMessagePack = "Please select path of PYTHON."
721 | $Pyth1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "python (python.exe)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
722 | If @error Then
723 | Else
724 | ; Check file path for spaces.
725 | If StringInStr($Pyth1, " ") > 0 Then
726 | MsgBox(0, "", "There is a space in the 'file' path, pls to select correct.")
727 | Else
728 | $Pyth1 = StringReplace($Pyth1, "|", @CRLF)
729 | GUICtrlSetData($Pyth, $Pyth1)
730 | IniWrite($line & "\mdictGui_.ini", "Python", "PythonPath", GUICtrlRead($Pyth))
731 | EndIf
732 | EndIf
733 | EndSelect
734 |
735 | ; Select script of addflex py---------------------------24
736 | Select
737 | Case $msg = $iButton_flexpy
738 | $sMessagePack = "Please select PY script addflex_mdx."
739 | $flexpy1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "addflex (addflex_df.py;addflex_mdx.py)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
740 | If @error Then
741 | Else
742 | $flexpy1 = StringReplace($flexpy1, "|", @CRLF)
743 | GUICtrlSetData($flexpy, $flexpy1)
744 | IniWrite($line & "\mdictGui_.ini", "Addflex", "addflexpy", GUICtrlRead($flexpy))
745 | ;-------------Label--addflex script
746 | If StringInStr(GUICtrlRead($flexpy), "addflex_mdx.py") > 0 Then
747 | GUICtrlCreateLabel(" Selected 'addflex_mdx py' -> Mdict", 500, 344, 240, 17)
748 | GUICtrlSetBkColor(-1, 0xFFFFFF)
749 | GUICtrlSetData($ComboInflex, "Standalone inflection")
750 | ElseIf StringInStr(GUICtrlRead($flexpy), "addflex_df.py") > 0 Then
751 | GUICtrlCreateLabel(" Selected 'addflex_df py' -> Kobo df", 500, 344, 240, 17)
752 | GUICtrlSetBkColor(-1, 0xFFFFFF)
753 | GUICtrlSetData($ComboInflex, "Kobo dictionary")
754 | Else
755 | EndIf
756 | ; Check file path for spaces.
757 | If StringInStr($flexpy1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
758 | ;----------------------
759 | EndIf
760 | EndSelect
761 |
762 | ; Select file of WordForm-----------------------------25
763 | Select
764 | Case $msg = $iButtonForm
765 | $sMessagePack = "Please select file of WordForm."
766 | $WordForm1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "Forms-Lng (*.txt)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
767 | If @error Then
768 | Else
769 | If StringInStr($WordForm1, "infl") Or StringInStr($WordForm1, "morph") > 0 Then
770 | MsgBox(0, "", "Selected WordForm may is not source, pls to select correct.")
771 | ElseIf StringInStr($WordForm1, "forms-") > 0 Then
772 | $WordForm1 = StringReplace($WordForm1, "|", @CRLF)
773 | $Form = _WinAPI_PathRemoveExtension($WordForm1)
774 | $sForms = 1
775 | GUICtrlSetData($WordForm, $WordForm1)
776 | ; Check file path for spaces.
777 | If StringInStr($WordForm1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
778 | ;----------------------
779 | Else
780 | MsgBox(0, "", "Selected WordForm not contain 'forms-', pls to select again.")
781 | EndIf
782 | EndIf
783 | EndSelect
784 |
785 | ; Select Choise Combo Inflex----------------------------26
786 | Select
787 | Case $msg = $ComboInflex
788 | $sComboReadInflex = GUICtrlRead($ComboInflex)
789 | EndSelect
790 |
791 | ; Select Button_ConvertFlex ----------------------------27
792 | Select
793 | Case $msg = $iButtonConvFlex
794 | If GUICtrlRead($Pyth) = "" Or GUICtrlRead($flexpy) = "" Or $sForms = 0 Then
795 | MsgBox(8192, "", "You are not chosen all of need file paths")
796 | Else
797 | $sComboReadInflex = GUICtrlRead($ComboInflex)
798 | If $sComboReadInflex = "Standalone inflection" Then
799 | If StringInStr(GUICtrlRead($flexpy), "addflex_df.py") > 0 Then MsgBox(0, "", "Selected Scrip for Kobo dict NOT convert properly.")
800 | If MsgBox(1, "Standalone inflection", "You choose WordForm file:" & @CRLF & "" & GUICtrlRead($WordForm) & "" & @CRLF & "will be convert to: " & $Form & "_infl.txt") = 1 Then
801 | $iPIDConvFlex = Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " " & GUICtrlRead($flexpy) & " -t " & GUICtrlRead($WordForm) & " -o " & $Form & "_infl.txt", "", @SW_SHOWNORMAL)
802 | $Un_ = $Form & "_infl"
803 | $sUnp = 1
804 | GUICtrlSetData($Unp, $Form & "_infl.txt")
805 | EndIf
806 | ElseIf $sComboReadInflex = "Morphological dictionary" Then
807 | If StringInStr(GUICtrlRead($flexpy), "addflex_df.py") > 0 Then MsgBox(0, "", "Selected Scrip for Kobo dict NOT convert properly.")
808 | If MsgBox(1, "Morphological dictionary", "You choose WordForm file:" & @CRLF & "" & GUICtrlRead($WordForm) & "" & @CRLF & "will be convert to: " & $Form & "_morph.txt") = 1 Then
809 | $iPIDConvFlex = Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " " & GUICtrlRead($flexpy) & " -l -t " & GUICtrlRead($WordForm) & " -o " & $Form & "_morph.txt", "", @SW_SHOWNORMAL)
810 | $Morph_ = $Form & "_morph"
811 | $sMorph = 1
812 | GUICtrlSetData($Morph, $Form & "_morph.txt")
813 | EndIf
814 | Else
815 | If $skob = 0 Then
816 | MsgBox(8192, "", "You are not chosen needed Kobo dictfile path")
817 | Else
818 | If StringInStr(GUICtrlRead($flexpy), "addflex_mdx.py") > 0 Then MsgBox(0, "", "Selected Scrip for Mdict NOT convert properly.")
819 | If MsgBox(1, "Kobo dictionary", "You choose WordForm file:" & @CRLF & "" & GUICtrlRead($WordForm) & "" & @CRLF & "will be convert to: " & $kobo_ & "_out.df") = 1 Then
820 | $iPIDConvFlex = Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " " & GUICtrlRead($flexpy) & " -i " & GUICtrlRead($kobo) & " -o " & $kobo_ & "_out.df -t " & GUICtrlRead($WordForm), "", @SW_SHOWNORMAL)
821 | EndIf
822 | EndIf
823 | EndIf
824 | EndIf
825 | EndSelect
826 |
827 | ; Select file of Morphological inflection---------------28
828 | Select
829 | Case $msg = $iButtonMorph
830 | $sMessagePack = "Please select Morphological inflection."
831 | $Morph1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "_morph (*.txt)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
832 | If @error Then
833 | Else
834 | $Morph1 = StringReplace($Morph1, "|", @CRLF)
835 | $Morph_ = _WinAPI_PathRemoveExtension($Morph1)
836 | $sMorph = 1
837 | GUICtrlSetData($Morph, $Morph1)
838 | ; Check file path for spaces.
839 | If StringInStr($Morph1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
840 | ;----------------------
841 | EndIf
842 | EndSelect
843 |
844 | ; Select Button_Concatenate-----------------------------29
845 | Select
846 | Case $msg = $iButtonConca
847 | If $sMorph = 0 Or $sUnp = 0 Then
848 | MsgBox(8192, "", "You are not chosen needed file paths")
849 | Else
850 | $Um_ = _WinAPI_PathRemoveExtension(GUICtrlRead($Unp))
851 | $Um_ = _WinAPI_PathRemoveExtension($Um_)
852 | If MsgBox(1, "Concatenate", "Concatenate 'Morpho dict' with 'source Mdict' to:" & @CRLF & $Um_ & "_morph.concat.txt ?") = 1 Then
853 | $iPIDconcat = Run(@ComSpec & " /k ""copy " & GUICtrlRead($Unp) & "+" & GUICtrlRead($Morph) & " " & $Um_ & "_morph.concat.txt", "", @SW_SHOWNORMAL)
854 | $Un_ = $Um_ & "_morph"
855 | $sUnp = 1
856 | GUICtrlSetData($Unp, $Um_ & "_morph.concat.txt")
857 | EndIf
858 | EndIf
859 | EndSelect
860 |
861 | ; Select Button InfoFlex--------------------------------30
862 | Select
863 | Case $msg = $iButtonInfoFlex
864 | If MsgBox(1, "Help addflex", "Go to Github for info addflex" & @CRLF & _
865 | "and guide 'How to addflex' ?") = 1 Then ShellExecute("https://github.com/jekovcar/mdict-utils-Gui/blob/main/Use%20mdict-utils-Gui.pdf")
866 | EndSelect
867 |
868 | ; Select path of Kobo dict -----------------------------31
869 | Select
870 | Case $msg = $iButtonKobo
871 | $sMessagePack = "Please select Kobo dictionary."
872 | $kobo1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "Kobo dict (*.df)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
873 | If @error Then
874 | Else
875 | $kobo1 = StringReplace($kobo1, "|", @CRLF)
876 | $kobo_ = _WinAPI_PathRemoveExtension($kobo1)
877 | $skob = 1
878 | GUICtrlSetData($kobo, $kobo1)
879 | ; Check file path for spaces.
880 | If StringInStr($kobo1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
881 | ;----------------------
882 | EndIf
883 | EndSelect
884 |
885 | ; Select path of Mdict.exe-------------------------------32
886 | Select
887 | Case $msg = $iButtonMdict
888 | $Mdict1 = FileOpenDialog("Please select your Mdict.exe.", @DesktopDir & "\", "Mdict (Mdict.exe)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
889 | If @error Then
890 | Else
891 | ; Check file path for spaces.
892 | If StringInStr($Mdict1, " ") > 0 Then
893 | MsgBox(0, "", "There is a space in the 'file' path, pls to select correct.")
894 | Else
895 | $Mdict1 = StringReplace($Mdict1, "|", @CRLF)
896 | GUICtrlSetData($Mdict, $Mdict1)
897 | IniWrite($line & "\mdictGui_.ini", "Mdict", "MdictPath", GUICtrlRead($Mdict))
898 | MsgBox(0, "", "Pls to restart Gui & Run 'Mdict Test' for effect.")
899 | EndIf
900 | EndIf
901 | EndSelect
902 |
903 | ; Select path of Fscript ------------------------------33
904 | Select
905 | Case $msg = $iButtonFscript
906 | $sMessagePack = "Please select path of wordform script."
907 | $Fscript1 = FileOpenDialog($sMessagePack, @DesktopDir & "\", "script (check_wordforms.py)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
908 | If @error Then
909 | Else
910 | ; Check file path for spaces.
911 | If StringInStr($Fscript1, " ") > 0 Then
912 | MsgBox(0, "", "There is a space in the 'file' path, pls to select correct.")
913 | Else
914 | $Fscript1 = StringReplace($Fscript1, "|", @CRLF)
915 | GUICtrlSetData($FScript, $Fscript1)
916 | IniWrite($line & "\mdictGui_.ini", "FScript", "FScriptpath", GUICtrlRead($FScript))
917 | EndIf
918 | EndIf
919 | EndSelect
920 |
921 | ; Select Button_Check-----------------------------------34
922 | Select
923 | Case $msg = $iButtonCheck
924 | If GUICtrlRead($FScript) = "" Or $sForms = 0 Then
925 | MsgBox(8192, "", "You are not chosen needed file paths")
926 | Else
927 | $iPIDfscript = Run(@ComSpec & " /k " & GUICtrlRead($Pyth) & " " & GUICtrlRead($FScript) & " " & GUICtrlRead($WordForm), "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
928 | Global $ResponseCheck
929 | While 1
930 | $ResponseCheck &= StdoutRead($iPIDfscript)
931 | If @error Then ExitLoop
932 | WEnd
933 | $ResponseCheck = StringReplace($ResponseCheck, @WorkingDir & ">", "")
934 | If StringInStr($ResponseCheck, "WARN") = 0 And StringInStr($ResponseCheck, "ERR") = 0 Then
935 | MsgBox(0, "Check Formss", $ResponseCheck & @CRLF & "The Word Forms file is OK")
936 | Else
937 | If MsgBox(1, "Check Formss", $ResponseCheck & @CRLF & "Please to view & fix :" & @CRLF & @WorkingDir & "\check_wordforms.log" & @CRLF _
938 | & @CRLF & "WARN can be ignored, but some inflections will be invalid." & @CRLF & "ERR won't generate valid inflections") = 1 Then
939 | Run("notepad.exe " & @WorkingDir & "\check_wordforms.log", @WindowsDir, @SW_SHOWNORMAL)
940 | EndIf
941 | EndIf
942 | Global $ResponseCheck = ""
943 | EndIf
944 | EndSelect
945 |
946 | ; Select File Title------------------------------------35
947 | Select
948 | Case $msg = $iButtonTitle
949 | $sMessageDescr = "Please select a Title."
950 | $Title1 = FileOpenDialog($sMessageDescr, @DesktopDir & "\", "Title File (*.*)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT))
951 | If @error Then
952 | Else
953 | $Title1 = StringReplace($Title1, "|", @CRLF)
954 | ; Check file is encoding of UTF
955 | Local $iEncoding = FileGetEncoding($Title1) ; Retrieve the file encoding of the current script.
956 | If @error Then
957 | MsgBox(8192, "", "Error: Could not obtain the file encoding.")
958 | ElseIf Not ($iEncoding = 256) + ($iEncoding = 128) Then
959 | If MsgBox(1, "File Title", "Selected Title is not UTF 8 :" & @CRLF & $Title1 & @CRLF _
960 | & @CRLF & "Do you want to edit (save in UTF-8) it in 'Notepad' ?") = 1 Then
961 | Run("notepad.exe " & $Title1, @WindowsDir, @SW_SHOWNORMAL)
962 | EndIf
963 | Else
964 | If FileGetSize($Title1) > 100 Then
965 | If MsgBox(257, "File Title", "Selected file : " & $Title1 & @CRLF & @CRLF _
966 | & "is too large for 'Title', recommended size <100 bytes" & @CRLF _
967 | & "OK to edit it in 'Notepad' or continue with selected ?") = 1 Then
968 | Run("notepad.exe " & $Title1, @WindowsDir, @SW_SHOWNORMAL)
969 | Else
970 | $sTit = 1
971 | GUICtrlSetData($Title, $Title1)
972 | GUICtrlSetState($ButtonTview, 16)
973 | GUICtrlSetState($ButtonTclean, 16)
974 | EndIf
975 | Else
976 | $sTit = 1
977 | GUICtrlSetData($Title, $Title1)
978 | GUICtrlSetState($ButtonTview, 16)
979 | GUICtrlSetState($ButtonTclean, 16)
980 | EndIf
981 | EndIf
982 | ; Check file path for spaces.
983 | If StringInStr($Title1, " ") > 0 Then MsgBox(0, "", "There is a space in the 'file' path and it may not work properly.")
984 | ;----------------------
985 | EndIf
986 | EndSelect
987 |
988 | ; Button_Title View-----------------------------36
989 | Select
990 | Case $msg = $ButtonTview
991 | If $sTit = 1 Then
992 | Run("notepad.exe " & GUICtrlRead($Title), @WindowsDir, @SW_SHOWNORMAL)
993 | Else
994 | EndIf
995 | EndSelect
996 |
997 | ; Button_Description View----------------------37
998 | Select
999 | Case $msg = $ButtonDview
1000 | If $sDesc = 1 Then
1001 | Run("notepad.exe " & GUICtrlRead($Descr), @WindowsDir, @SW_SHOWNORMAL)
1002 | Else
1003 | EndIf
1004 | EndSelect
1005 |
1006 | ; Button_Description Clean----------------38
1007 | Select
1008 | Case $msg = $ButtonDclean
1009 | If $sDesc = 1 Then
1010 | GUICtrlSetData($Descr, "File Descripton")
1011 | $sDesc = 0
1012 | GUICtrlSetState($ButtonDview, 32)
1013 | GUICtrlSetState($ButtonDclean, 32)
1014 | Else
1015 | EndIf
1016 | EndSelect
1017 |
1018 | ; Button_Title Clean---------------39
1019 | Select
1020 | Case $msg = $ButtonTclean
1021 | If $sTit = 1 Then
1022 | GUICtrlSetData($Title, "File Title")
1023 | $sTit = 0
1024 | GUICtrlSetState($ButtonTview, 32)
1025 | GUICtrlSetState($ButtonTclean, 32)
1026 | Else
1027 | EndIf
1028 | EndSelect
1029 |
1030 | WEnd
1031 | Run(@ComSpec & " /c taskkill /IM cmd.exe /F", "", @SW_HIDE)
1032 | GUIDelete($hGUI1)
1033 | If $iPIDPack Then ProcessClose($iPIDPack)
1034 | If $iPIDUnPack Then ProcessClose($iPIDUnPack)
1035 | If $iPIDPackMDD Then ProcessClose($iPIDPackMDD)
1036 | If $iPIDUnMDD Then ProcessClose($iPIDUnMDD)
1037 | If $iPIDMeta Then ProcessClose($iPIDMeta)
1038 | If $iPIDversPyth Then ProcessClose($iPIDversPyth)
1039 | If $iPIDversMdict Then ProcessClose($iPIDversMdict)
1040 | If $iPIDconv_db Then ProcessClose($iPIDconv_db)
1041 | If $iPIDUn_db Then ProcessClose($iPIDUn_db)
1042 | If $iPIDPack_all Then ProcessClose($iPIDPack_all)
1043 | If $iPIDUnPack_db Then ProcessClose($iPIDUnPack_db)
1044 | If $iPIDUnPack_zip Then ProcessClose($iPIDUnPack_zip)
1045 | If $iPIDUnPackSplit Then ProcessClose($iPIDUnPackSplit)
1046 | If $iPIDquery Then ProcessClose($iPIDquery)
1047 | If $iPIDConvFlex Then ProcessClose($iPIDConvFlex)
1048 | If $iPIDconcat Then ProcessClose($iPIDconcat)
1049 | If $iPIDfscript Then ProcessClose($iPIDfscript)
1050 | EndFunc ;==>MDictGUI
1051 |
--------------------------------------------------------------------------------