Guest User

Untitled

a guest
Jun 12th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.78 KB | None | 0 0
  1. #include <GUIConstantsEx.au3>
  2. #include <WindowsConstants.au3>
  3. #include <StaticConstants.au3>
  4. #include <EditConstants.au3>
  5. #include <Constants.au3>
  6. #include <File.au3>
  7. #include <Array.au3>
  8. #include <String.au3>
  9. #include <FTPEx.au3>
  10. #include <DateTimeConstants.au3>
  11. #include <GDIPlus.au3>
  12. #include <WinAPI.au3>
  13.  
  14.  
  15. Opt("MustDeclareVars", 1) ;===> All globals have to be declared
  16.  
  17. ;==========================================================
  18. ;========== Globals... what else... =======================
  19. ;==========================================================
  20. Global $filename, $path, $directory, $pic1, $WinTitle
  21. Global $slotname1, $slotname2, $slot, $adress
  22. Global $box1, $box2, $box3, $box4, $box5, $label_1, $label_2, $label_3, $label_4, $label_5, $EditText1, $EditText2, $EditText3, $EditText4, $EditText5
  23. Global $ConnButton, $NewButton, $ExitButton, $SaveButton, $screenButton, $SaveButton, $EditButton
  24. Global $font, $date, $WinMain, $DTM_SETFORMAT_, $progname, $icon, $file
  25. Global $string1, $string2, $string3, $string4, $string5, $chars, $chars1, $chars2
  26. Global $Open, $Conn, $username, $pass, $Ftpc, $Conn, $server, $ftpFile, $ftpFile1, $right, $right1
  27. Global $timestamp, $screendate, $Screenshot_name, $debugpath, $debugname, $trackname, $trackpath
  28. Global $picname, $picpath, $pmdname, $pmdpath
  29. Global $hGUI, $hImage, $hGraphic, $hImage1, $ping, $short_picname, $hGraphic1, $pic2, $hGraphic2
  30. Global $pic3, $hImage2, $hGraphics, $png_file, $screen_pic, $dummypic
  31. Global $group1, $group2, $group3, $edit, $hDC
  32. Global $radio1, $radio2, $radio3
  33.  
  34. Global Const $STM_SETIMAGE = 0x0172
  35. Global $msg
  36.  
  37. Local $style = "yyyy-MM-dd_HH-mm-ss"
  38.  
  39. ;==========================================================
  40. ;======= Here we go... ====================================
  41. ;==========================================================
  42.  
  43. _Main()
  44.  
  45. Func _Main()
  46. ;==========================================================
  47. ;====== call func ebiniread to readout ini ================
  48. ;==========================================================
  49. _ebiniread()
  50.  
  51. ;==========================================================
  52. ;====== set gui ===========================================
  53. ;==========================================================
  54. $WinMain = GUICreate($progname, 1200, 800, -1, -1, $WS_EX_OVERLAPPEDWINDOW)
  55. GUISetBkColor(0x182424) ;~ set background color
  56.  
  57. ;======= Set JPEG on mainscreen
  58. $pic1 = GUICtrlCreatePic(@ScriptDir & '\EB-Grafik_oben.jpg', 15, 15, 600, 100, BitOR($SS_NOTIFY, $WS_CLIPSIBLINGS))
  59. $icon = GUISetIcon(@ScriptDir & '\EB.ico')
  60.  
  61. #cs
  62. ;==========================================================
  63. ;========= set box for timestamp ==========================
  64. sets the box to show the timestamp. The box is disabled, because there
  65. is nothing to set manually.
  66. The included timestamp is generated by clicking the $newbutton in the GUI
  67. ;==========================================================
  68. #ce
  69. $date = GUICtrlCreateDate("", 1020, 60, 150, 20)
  70. GUICtrlSetFont($date, 10, 1000, 0, $font)
  71. GUICtrlSetColor(-1, 0xFAFFFF)
  72. GUICtrlSetState($date, $GUI_DISABLE)
  73. $DTM_SETFORMAT_ = 0x1032
  74. GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style)
  75.  
  76. #cs
  77. ;==========================================================
  78. ;============ Radiobuttons ================================
  79. ;==========================================================
  80. Comment:
  81. the following group with radio buttons is generated to set the online- or offline version
  82. ;==========================================================
  83. #ce
  84. $group1 = GUICtrlCreateGroup("Settings", 680, 15, 200, 100)
  85. GUICtrlSetFont(-1, 11, 1000, 0, $font)
  86. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  87.  
  88. $radio1 = GUICtrlCreateRadio("Online-Modus", 710, 45, 140, 20)
  89. GUICtrlSetFont(-1, 11, 1000, 0, $font)
  90. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  91.  
  92. $radio2 = GUICtrlCreateRadio("Offline-Modus", 710, 75, 140, 20)
  93. GUICtrlSetFont(-1, 11, 1000, 0, $font)
  94. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  95.  
  96. GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
  97.  
  98. ;==========================================================
  99. ;============ Generate textboxes ==========================
  100. ;==========================================================
  101.  
  102. ;==========================================================
  103. ;========= Textbox 1 incl. label ==========================
  104. ;==========================================================
  105.  
  106. ;=== Label Box1
  107. $label_1 = GUICtrlCreateLabel($box1, 130, 120, 200, 20, $font)
  108. GUICtrlSetFont($label_1, 11, 1000, 0, $font)
  109. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  110. ;=== Textbox1
  111. $EditText1 = GUICtrlCreateEdit('', 130, 140, 900, 20, $ES_AUTOHSCROLL)
  112. GUICtrlSetFont($EditText1, 10, 1000, 0, $font)
  113. GUICtrlSetColor(-1, 0xFAFFFF)
  114. GUICtrlSetBkColor(-2, 0x000000)
  115.  
  116. ;==========================================================
  117. ;========== Textbox 2 incl. label =========================
  118. ;==========================================================
  119.  
  120. ;=== Label Box2
  121. $label_2 = GUICtrlCreateLabel($box2, 130, 170, 200, 20, $font)
  122. GUICtrlSetFont($label_2, 11, 1000, 0, $font)
  123. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  124. ;=== Textbox2
  125. $EditText2 = GUICtrlCreateEdit('', 130, 190, 900, 150)
  126. GUICtrlSetFont($EditText2, 10, 1000, 0, $font)
  127. GUICtrlSetColor(-1, 0xFAFFFF)
  128. GUICtrlSetBkColor(-2, 0x000000)
  129.  
  130. ;==========================================================
  131. ;=========== Textbox 3 incl. label ========================
  132. ;==========================================================
  133.  
  134. ;=== Label Box3
  135. $label_3 = GUICtrlCreateLabel($box3, 130, 350, 200, 20, $font)
  136. GUICtrlSetFont($label_3, 11, 1000, 0, $font)
  137. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  138. ;=== Textbox3
  139. $EditText3 = GUICtrlCreateEdit('', 130, 370, 900, 150)
  140. GUICtrlSetFont($EditText3, 10, 1000, 0, $font)
  141. GUICtrlSetColor(-1, 0xFAFFFF)
  142. GUICtrlSetBkColor(-2, 0x000000)
  143.  
  144. ;==========================================================
  145. ;=========== Textbox 4 incl. label ========================
  146. ;==========================================================
  147.  
  148. ;=== Label Box4
  149. $label_4 = GUICtrlCreateLabel($box4, 130, 530, 200, 20, $font)
  150. GUICtrlSetFont($label_4, 11, 1000, 0, $font)
  151. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  152. ;=== Textbox3
  153. $EditText4 = GUICtrlCreateEdit('', 130, 550, 450, 100)
  154. GUICtrlSetFont($EditText4, 10, 1000, 0, $font)
  155. GUICtrlSetColor(-1, 0xFAFFFF)
  156. GUICtrlSetBkColor(-2, 0x000000)
  157.  
  158. ;==========================================================
  159. ;=========== Textbox 5 incl. label ========================
  160. ;==========================================================
  161.  
  162. ;=== Label Box5
  163. $label_5 = GUICtrlCreateLabel($box5, 130, 660, 200, 20, $font)
  164. GUICtrlSetFont($label_5, 11, 1000, 0, $font)
  165. GUICtrlSetColor(-1, 0xFFFFFF) ; weiß
  166. ;=== Textbox3
  167. $EditText5 = GUICtrlCreateEdit('', 130, 680, 450, 100)
  168. GUICtrlSetFont($EditText5, 10, 1000, 0, $font)
  169. GUICtrlSetColor(-1, 0xFAFFFF)
  170. GUICtrlSetBkColor(-2, 0x000000)
  171. ;==========================================================
  172. ;========= generate BUTTONS ===============================
  173. ;==========================================================
  174.  
  175. $ConnButton = GUICtrlCreateButton("Connect to target", 1070, 400, 100, 60, 0, $WS_EX_CLIENTEDGE)
  176. GUICtrlSetState(-1, $GUI_DISABLE) ;disable button until connection established
  177.  
  178. $ExitButton = GUICtrlCreateButton('Exit', 1070, 140, 100, 60, 0, $WS_EX_CLIENTEDGE)
  179. GUICtrlSetBkColor(-1, 0xCC3300)
  180.  
  181. $NewButton = GUICtrlCreateButton("New report", 1070, 320, 100, 60, 0, $WS_EX_CLIENTEDGE)
  182. GUICtrlSetState(-1, $GUI_DISABLE) ;disable button until connection established
  183.  
  184. $screenButton = GUICtrlCreateButton('Take Screenshot', 1070, 480, 100, 60, 0, $WS_EX_CLIENTEDGE)
  185. GUICtrlSetState(-1, $GUI_DISABLE) ;disable button until connection established
  186.  
  187.  
  188. $EditButton = GUICtrlCreateButton('Open Textfile', 1070, 560, 100, 60, 0, $WS_EX_CLIENTEDGE)
  189. GUICtrlSetState(-1, $GUI_DISABLE) ;disable button until Textfile is written
  190.  
  191. $SaveButton = GUICtrlCreateButton('Save Text', 1070, 640, 100, 60, 0, $WS_EX_CLIENTEDGE)
  192. GUICtrlSetState(-1, $GUI_DISABLE) ;disable button until connection established
  193.  
  194. $pic1 = GUICtrlCreatePic(@ScriptDir & '\EB-Grafik_oben.jpg', 15, 15, 600, 100, BitOR($SS_NOTIFY, $WS_CLIPSIBLINGS))
  195.  
  196. ;==========================================================
  197. ;====== start GDI+ ========================================
  198. ;==========================================================
  199.  
  200. ;==========================================================
  201. ;====== call func to set start logo to GUI ================
  202.  
  203. ;==========================================================
  204. ;====== show GUI ==========================================
  205. ;==========================================================
  206. GUISetState() ; ====> show window
  207.  
  208. ;==========================================================
  209. ;=============================== Events ===================
  210. ;==========================================================
  211.  
  212. While 1
  213. Switch GUIGetMsg()
  214. Case $WinMain
  215. Case $radio1
  216. GUICtrlSetState($ConnButton, $GUI_ENABLE) ;enable connect button
  217. GUICtrlSetBkColor($ConnButton, 0xCC3300) ; set Background color
  218. _WinAPI_RedrawWindow($WinMain) ; redraw complete window
  219.  
  220. Case $radio2
  221. GUICtrlSetState($ConnButton, $GUI_DISABLE) ;enable connect button
  222. GUICtrlSetBkColor($ConnButton, 0xCC3300)
  223. GUICtrlSetState($NewButton, $GUI_ENABLE) ;enable NEW button
  224. _WinAPI_RedrawWindow($WinMain)
  225.  
  226. Case $GUI_EVENT_CLOSE ;===== if you press the x in the topbar exit script
  227. WinClose($WinTitle, "")
  228. ExitLoop
  229.  
  230. Case $ConnButton ;===== Connect PC with target via FTP
  231. _ftp()
  232. GUICtrlSetState($screenButton, $GUI_ENABLE)
  233. GUICtrlSetBkColor($screenButton, 0x00FF00); rün: 0x00FF00
  234. _WinAPI_RedrawWindow($WinMain)
  235.  
  236. Case $NewButton ;===== new bug found
  237. GUICtrlSetBkColor($NewButton, 0xFF0000); grün: 0x00FF00
  238. GUICtrlSetState($SaveButton, $GUI_ENABLE) ; activate SaveButton
  239. _WinAPI_RedrawWindow($WinMain) ; redraw complete window
  240. GUICtrlSetState($NewButton, $GUI_DISABLE) ; deactivate NewButton until Savebutton is clicked
  241.  
  242. ;====== call func _dateset to set timestamp
  243. _dateset()
  244.  
  245. ;====== get local date and time from box to create dir-name
  246. $timestamp = GUICtrlRead($date)
  247.  
  248. GUICtrlSetState($date, $GUI_DISABLE) ; deactivate date input
  249.  
  250. ;====== create local directory with local date and time to save files
  251. If (DirCreate($directory & $timestamp) == 0) Then;
  252. MsgBox(16, "Attention!", "No Folder created." & @CRLF & "Please restart the program")
  253. ;Exit
  254. EndIf
  255.  
  256. _WinAPI_RedrawWindow($WinMain, $RDW_UPDATENOW)
  257.  
  258. ;====== call func _ftpdownload to get all neccessary files from SD card, if RadioButton1 is activated
  259. Local $logoread = GUICtrlRead($radio1)
  260. If $logoread = 1 Then
  261. _ftpdownload()
  262. EndIf
  263. _WinAPI_RedrawWindow($WinMain)
  264.  
  265.  
  266. Case $screenButton ;====== Take Screenshot ======
  267. ;===== call func _screen_dateset to get new timestamp
  268. ConsoleWrite(@ScriptLineNumber & " Call _screen_dateset()" & @CRLF)
  269. _screen_dateset() ; set timestamp for screenshot
  270.  
  271. ;===== open Telnet to connect to target
  272. ConsoleWrite(@ScriptLineNumber & " Call _telnet()" & @CRLF)
  273. _telnet() ; open telnet connection
  274. _WinAPI_RedrawWindow($WinMain, $RDW_UPDATENOW)
  275.  
  276.  
  277. ;===== call func _screenshot to take screenshot
  278. ConsoleWrite(@ScriptLineNumber & " Call _screenshot()" & @CRLF)
  279. _screenshot() ; call func
  280. _WinAPI_RedrawWindow($WinMain, $RDW_UPDATENOW)
  281.  
  282.  
  283. ;===== main structure to take screenshot
  284. While WinExists($WinTitle, "")
  285. If WinActive($WinTitle, "") Then
  286. HotKeySet("{F10}", "_screenshot")
  287. Else
  288. ExitLoop
  289. HotKeySet("{F10}")
  290. EndIf
  291. Sleep(20)
  292. WEnd
  293. Sleep(2000)
  294. _WinAPI_RedrawWindow($WinMain)
  295.  
  296.  
  297. Case $SaveButton ;====== Button to save textbox input to file
  298. GUICtrlSetState($NewButton, $GUI_ENABLE)
  299. GUICtrlSetState($SaveButton, $GUI_DISABLE)
  300. GUICtrlSetBkColor($NewButton, 0x00FF00); rün: 0x00FF00, rot: 0xFF0000
  301. ;====== save all textboxes to textfile
  302. $file = FileOpen($directory & $timestamp & '\' & $filename, 2)
  303. $string1 = GUICtrlRead($EditText1)
  304. $string2 = GUICtrlRead($EditText2)
  305. $string3 = GUICtrlRead($EditText3)
  306. $string4 = GUICtrlRead($EditText4)
  307. $string5 = GUICtrlRead($EditText5)
  308. FileWrite($file, $box1 & @CRLF)
  309. FileWrite($file, $string1 & @CRLF & @CRLF)
  310. FileWrite($file, $box2 & @CRLF)
  311. FileWrite($file, $string2 & @CRLF & @CRLF)
  312. FileWrite($file, $box3 & @CRLF)
  313. FileWrite($file, $string3 & @CRLF & @CRLF)
  314. FileWrite($file, $box4 & @CRLF)
  315. FileWrite($file, $string4 & @CRLF & @CRLF)
  316. FileWrite($file, $box5 & @CRLF)
  317. FileWrite($file, $string5 & @CRLF & @CRLF)
  318. FileClose($file)
  319. If FileExists($directory & $timestamp & '\' & $filename) Then ;===== Lookup Textfile and activate Edit_Button
  320. GUICtrlSetState($EditButton, $GUI_ENABLE)
  321. EndIf
  322. _WinAPI_RedrawWindow($WinMain)
  323.  
  324. ;====== clear the first 4 textboxes
  325. GUICtrlSetData($EditText1, "")
  326. GUICtrlSetData($EditText2, "")
  327. GUICtrlSetData($EditText3, "")
  328. GUICtrlSetData($EditText4, "")
  329.  
  330. _WinAPI_RedrawWindow($WinMain, $RDW_UPDATENOW)
  331.  
  332.  
  333. Case $EditButton ;===== opens editor to work with saved Textfile
  334. $edit = ShellExecuteWait($directory & $timestamp & '\' & $filename)
  335. ConsoleWrite(@ScriptLineNumber & " ShellExecuteWait($directory & $timestamp & '\' & $filename: " & $directory & $timestamp & '\' & $filename & @CRLF)
  336. While ProcessExists($edit)
  337. WEnd
  338. _WinAPI_RedrawWindow($WinMain)
  339.  
  340.  
  341. Case $ExitButton ;===== end programm
  342. WinClose($WinTitle, "")
  343. ExitLoop
  344. EndSwitch
  345. WEnd
  346. EndFunc ;==>_Main
  347.  
  348. ;======= End _Main ==================================
  349.  
  350.  
  351. ;====================================================
  352. ;====================================================
  353. ;=========== single functions =======================
  354. ;====================================================
  355. ;====================================================
  356.  
  357.  
  358. ;======= Set date and timestamp for bugreport =======
  359. Func _dateset()
  360. GUICtrlDelete($date) ;= reset old timestamp
  361. $date = GUICtrlCreateDate("", 1020, 60, 150, 20)
  362. GUICtrlSetFont($date, 10, 1000, 0, $font)
  363. GUICtrlSetColor(-1, 0xFAFFFF)
  364. GUICtrlSetBkColor(-2, 0x000000)
  365.  
  366. ;=======set format of the timestamp
  367. $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
  368. GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style)
  369. EndFunc ;==>_dateset
  370.  
  371.  
  372. ;====================================================
  373. ;========= FTP Funcs ================================
  374. ;====================================================
  375.  
  376. ;========= FTP function to save defined files =======
  377. Func _ftp()
  378. ;~======= FTP-Data
  379. Local $server = $adress
  380. ConsoleWrite(@ScriptLineNumber & " Local $server = $adress: " & $server & @CRLF)
  381. Local $username = ''
  382. Local $pass = ''
  383. Local $u, $ftpFile, $file, $right, $p, $ftpFile1, $file1, $right1, $slot
  384. Local $Open = _FTP_Open('MyFTP Control')
  385. If @error Then
  386. MsgBox(16, "FTP_Open_Error", "No FTP connection to" & @CRLF & $adress & " possible!")
  387. EndIf
  388. $Conn = _FTP_Connect($Open, $server, $username, $pass)
  389. If @error Then
  390. MsgBox(16, "FTP_Connect_Error", "No FTP connection to" & @CRLF & $adress & " possible!")
  391. Else
  392. ;===== activate buttons, disabled at startup
  393. GUICtrlSetBkColor($ConnButton, 0x00ff00) ; Green
  394. GUICtrlSetState($SaveButton, $GUI_ENABLE)
  395. GUICtrlSetState($NewButton, $GUI_ENABLE)
  396. EndIf
  397. EndFunc ;==>_ftp
  398.  
  399.  
  400. ;======= download function to get all ness. files from target
  401. Func _ftpdownload()
  402. $slot = $slotname1
  403. _FTP_DirSetCurrent($Conn, $slot)
  404. If @error Then
  405. MsgBox(16, "Dir_error", "No FTP connection to" & @CRLF & $adress & " possible!")
  406. EndIf
  407.  
  408. $ftpFile = _Ftp_ListToArray($Conn, 2)
  409. If IsArray($ftpFile) Then
  410. For $u = 1 To $ftpFile[0]
  411. $right = StringRight($ftpFile[$u], 4)
  412. If $right = $debugname Or $right = $picname Or $right = $pmdname Then
  413. _FTP_FileGet($Conn, $ftpFile[$u], $directory & $timestamp & "\" & $ftpFile[$u])
  414. If @error Then
  415. _sloterror()
  416. EndIf
  417. If $right = $debugname Or $right = $picname Or $right = $pmdname Then
  418. _FTP_FileDelete($Conn, $ftpFile[$u])
  419. If @error Then
  420. MsgBox(16, "Error", "Could not delete copied files on " & $slot & " !" & @CRLF & "Please delete files manually!", 10)
  421. EndIf
  422. EndIf
  423. EndIf
  424. Next
  425. Else
  426. MsgBox(16, "Error", "No FTP connection to" & @CRLF & $adress & " possible!")
  427. EndIf
  428.  
  429. $slot = $slotname2
  430. _FTP_DirSetCurrent($Conn, $slot)
  431.  
  432. $ftpFile1 = _Ftp_ListToArray($Conn, 2)
  433. If IsArray($ftpFile1) Then
  434. For $p = 1 To $ftpFile1[0]
  435. $right1 = StringRight($ftpFile1[$p], 4)
  436. If $right1 = $trackname Then
  437. _FTP_FileGet($Conn, $ftpFile1[$p], $directory & $timestamp & "\" & $ftpFile1[$p])
  438. If @error Then
  439. _sloterror()
  440. EndIf
  441. If $right1 = $debugname Then
  442. _FTP_FileDelete($Conn, $ftpFile1[$p])
  443. If @error Then
  444. MsgBox(16, "Error", "Could not clean up " & $slot & " !" & @CRLF & "Please delete files manually!" & @CRLF & @CRLF & "Files are stored in " & $directory & $timestamp, 10)
  445. EndIf
  446. EndIf
  447. EndIf
  448. Next
  449. Else
  450. MsgBox(16, "Error", "No FTP connection to" & @CRLF & $adress & " possible!")
  451. EndIf
  452. EndFunc ;==>_ftpdownload
  453.  
  454.  
  455. ;==========================================================
  456. ;=========== Screenshot functions =========================
  457. ;==========================================================
  458.  
  459. ;============== Set Date and timestamp for screenshots ====
  460. Func _screen_dateset()
  461. GUICtrlDelete($screendate) ;= reset old timestamp
  462. $screendate = GUICtrlCreateDate("", 1, 1, 10, 10)
  463. GUICtrlSetFont($screendate, 0, 0, 0, $font)
  464.  
  465. ;=======set format of the timestamp
  466. $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
  467. GUICtrlSendMsg($screendate, $DTM_SETFORMAT_, 0, $style)
  468.  
  469. EndFunc ;==>_screen_dateset
  470.  
  471. ;======= Func to open telnet connection ===================
  472. Func _telnet()
  473. ; Run Telnet
  474. Local $telnet = Run("telnet " & $adress, @SystemDir) ; @SW_HIDE, , $STDIN_CHILD + $STDOUT_CHILD
  475. ConsoleWrite(@ScriptLineNumber & " Run( telnet & $adress, @SystemDir): " & $telnet & @CRLF)
  476. WinWait("Telnet " & $adress, "", 1)
  477.  
  478. ;======= Rename window
  479. $WinTitle = "Telnet connection to MIB target <<- Screenshot ->>"
  480. WinSetTitle("Telnet " & $adress, "", $WinTitle)
  481. WinMove($WinTitle, "", 0, 0, 30, 30)
  482. EndFunc ;==>_telnet
  483.  
  484. ;======== take screenshot =================================
  485. Func _screenshot()
  486. If (WinActivate($WinTitle) = 0) Then
  487. MsgBox(48, "Attention", "Could not copy any files from:" & @CRLF & $slot)
  488. Exit
  489. EndIf
  490. $short_picname = StringRight($picname, 3)
  491. ConsoleWrite(@ScriptLineNumber & " Func _screenshot, StringRight($picname, 3)" & $short_picname & @CRLF)
  492. GUICtrlSetBkColor($screenButton, 0xFF0000); rot: 0xFF0000
  493.  
  494. Local $picpath1 = StringTrimLeft($picpath, 1) ;===> cut left backslash from ini entry
  495. ConsoleWrite(@ScriptLineNumber & " Func _screenshot, StringTrimLeft($picpath, 1)" & $picpath1 & @CRLF)
  496.  
  497. Local $picpath2 = StringTrimRight($picpath1, 1) ;===> cut right backslash from ini entry
  498. ConsoleWrite(@ScriptLineNumber & " Func _screenshot, StringTrimLeft($picpath, 1)" & $picpath2 & @CRLF)
  499.  
  500. $Screenshot_name = GUICtrlRead($screendate)
  501. ConsoleWrite(@ScriptLineNumber & " Func _screenshot, GUICtrlRead($screendate)" & $Screenshot_name & @CRLF)
  502.  
  503. xSend($WinTitle, "cd " & $picpath2 & "{ENTER}")
  504. xSend($WinTitle, "screenshot.exe " & $picpath & $Screenshot_name & $picname & " image/" & $short_picname & "{ENTER}")
  505. ConsoleWrite(@ScriptLineNumber & " Func _screenshot, $picpath & $Screenshot_name & $picname & image / & $short_picname" & $picpath & $Screenshot_name & $picname & " image/" & $short_picname & @CRLF)
  506. Sleep(100)
  507.  
  508. ; xSend($WinTitle, "cd.. " & "{ENTER}")
  509. ; WinClose($WinTitle, "")
  510. GUICtrlDelete($screendate)
  511. GUICtrlSetBkColor($screenButton, 0x00FF00); grün: 0x00FF00
  512. EndFunc ;==>_screenshot
  513.  
  514. ;====== telnet input for screenshot =======================
  515. Func xSend($aWinTitle, $aString)
  516. WinActivate($aWinTitle, "")
  517. Send($aString)
  518. EndFunc ;==>xSend
  519. ;====== get screenshot from target and show in window =====
  520.  
  521. ;======= Redraw func to set PNG to WinMain if programm has been minimized
  522.  
  523.  
  524. ;==========================================================
  525. ;======== Funcs to read or write the INIfile ==============
  526. ;==========================================================
  527.  
  528. ;======= Func to read out added inifile ===================
  529. Func _ebiniread()
  530. If (FileOpen(@ScriptDir & '\EB.ini', 0)) Then
  531. $progname = IniRead(@ScriptDir & '\EB.ini', 'NAME', 'progname', 'EB-Bugreporter')
  532. $box1 = IniRead(@ScriptDir & '\EB.ini', 'BOXES', 'box1', 'Summary')
  533. $box2 = IniRead(@ScriptDir & '\EB.ini', 'BOXES', 'box2', 'Preconditions')
  534. $box3 = IniRead(@ScriptDir & '\EB.ini', 'BOXES', 'box3', 'Action')
  535. $box4 = IniRead(@ScriptDir & '\EB.ini', 'BOXES', 'box4', 'Bug')
  536. $box5 = IniRead(@ScriptDir & '\EB.ini', 'BOXES', 'box5', 'Environments')
  537. $directory = IniRead(@ScriptDir & '\EB.ini', 'SAVEPATH', 'path', 'C:\Testfiles\')
  538. $slotname1 = IniRead(@ScriptDir & '\EB.ini', 'TARGET', 'sdslot1', '\SDCARD0\')
  539. $slotname2 = IniRead(@ScriptDir & '\EB.ini', 'TARGET', 'sdslot2', '\SDCARD1\')
  540. $adress = IniRead(@ScriptDir & '\EB.ini', 'TARGET', 'adress', '192.168.1.4')
  541. $filename = IniRead(@ScriptDir & '\EB.ini', 'REPORT', 'name', 'Testfile.txt')
  542. $dummypic = IniRead(@ScriptDir & '\EB.ini', 'REPORT', 'dummypic', 'EB-Logo.png')
  543. $debugpath = IniRead(@ScriptDir & '\EB.ini', 'FILEPATH', 'debugpath', '\SDCARD0\')
  544. $trackpath = IniRead(@ScriptDir & '\EB.ini', 'FILEPATH', 'trackpath', '\SDCARD1\navigation\tracks\')
  545. $picpath = IniRead(@ScriptDir & '\EB.ini', 'FILEPATH', 'picpath', '\SDCARD0\')
  546. $pmdpath = IniRead(@ScriptDir & '\EB.ini', 'FILEPATH', 'picpath', '\SDCARD0\')
  547. $debugname = IniRead(@ScriptDir & '\EB.ini', 'FILES', 'debug', '.dbg')
  548. $trackname = IniRead(@ScriptDir & '\EB.ini', 'FILES', 'track', '.trk')
  549. $picname = IniRead(@ScriptDir & '\EB.ini', 'FILES', 'pic', '.png')
  550. $pmdname = IniRead(@ScriptDir & '\EB.ini', 'FILES', 'pmd', '.log')
  551. Else
  552. _ebiniwrite() ;= if no inifile found, create own new standard ini
  553. EndIf
  554. FileClose(@ScriptDir & '\EB.ini')
  555. EndFunc ;==>_ebiniread
  556.  
  557.  
  558. ;======= Func to write new ini, if inifile is not present =
  559. Func _ebiniwrite()
  560. $progname = IniWrite(@ScriptDir & '\EB.ini', 'NAME', 'progname', 'EB-Bugreporter')
  561. $box2 = IniWrite(@ScriptDir & '\EB.ini', 'BOXES', 'box2', 'Preconditions')
  562. $box3 = IniWrite(@ScriptDir & '\EB.ini', 'BOXES', 'box3', 'Action')
  563. $box4 = IniWrite(@ScriptDir & '\EB.ini', 'BOXES', 'box4', 'Bug')
  564. $box5 = IniWrite(@ScriptDir & '\EB.ini', 'BOXES', 'box5', 'Environments')
  565. $directory = IniWrite(@ScriptDir & '\EB.ini', 'SAVEPATH', 'path', 'C:\Testfiles\')
  566. $slotname1 = IniWrite(@ScriptDir & '\EB.ini', 'TARGET', 'sdslot1', '\SDCARD0\')
  567. $slotname2 = IniWrite(@ScriptDir & '\EB.ini', 'TARGET', 'sdslot2', '\SDCARD1\')
  568. $adress = IniWrite(@ScriptDir & '\EB.ini', 'TARGET', 'adress', '192.168.1.4')
  569. $filename = IniWrite(@ScriptDir & '\EB.ini', 'REPORT', 'name', 'Testfile.txt')
  570. $dummypic = IniWrite(@ScriptDir & '\EB.ini', 'REPORT', 'dummypic', 'EB-Logo.png')
  571. $debugpath = IniWrite(@ScriptDir & '\EB.ini', 'FILEPATH', 'debugpath', '\SDCARD0\')
  572. $trackpath = IniWrite(@ScriptDir & '\EB.ini', 'FILEPATH', 'trackpath', '\SDCARD1\navigation\tracks\')
  573. $picpath = IniWrite(@ScriptDir & '\EB.ini', 'FILEPATH', 'picpath', '\SDCARD0\')
  574. $pmdpath = IniWrite(@ScriptDir & '\EB.ini', 'FILEPATH', 'pmdpath', '\SDCARD0\')
  575. $debugname = IniWrite(@ScriptDir & '\EB.ini', 'FILES', 'debug', '.dbg')
  576. $trackname = IniWrite(@ScriptDir & '\EB.ini', 'FILES', 'track', '.trk')
  577. $picname = IniWrite(@ScriptDir & '\EB.ini', 'FILES', 'pic', '.png')
  578. $pmdname = IniWrite(@ScriptDir & '\EB.ini', 'FILES', 'pmd', '.log')
  579. MsgBox(48, "Attention", "EB.ini missed in scriptfolder." & @CRLF & "Defaults have been set to new EB.ini." & @CRLF & @CRLF & "Please have a look into your programm folder" & @CRLF & @CRLF & "The program has to be started again.")
  580. WinClose($WinTitle, "")
  581. Local $Ftpc = _FTP_Close($Open)
  582. Exit
  583. EndFunc ;==>_ebiniwrite
  584.  
  585. ;==========================================================
  586. ;====== Oooops-funcs following ============================
  587. ;==========================================================
  588.  
  589. Func _sloterror()
  590. MsgBox(48, "Attention", "Could not copy any files from:" & @CRLF & $slot)
  591. WinClose($WinTitle, "")
  592. Local $Ftpc = _FTP_Close($Open)
  593. Return 0
  594. EndFunc ;==>_sloterror
  595.  
  596.  
  597. Func _telneterror()
  598. MsgBox(16, "Error", "No TELNET connection to" & @CRLF & $adress & " possible!")
  599. WinClose($WinTitle, "")
  600. Local $Ftpc = _FTP_Close($Open)
  601. Return -1
  602. ;Exit
  603. EndFunc ;==>_telneterror
  604.  
  605. ;==========================================================
  606. ;====== End ===============================================
  607. ;==========================================================
Add Comment
Please, Sign In to add comment