Code : Tout sélectionner
; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.2.12.1
; Author: Thorsten Meger
;
; Script Function:
; Organize Includes Version 4.3
;
; ----------------------------------------------------------------------------
;Opt('TrayIconDebug', 1)
Opt('MustDeclareVars', 1)
Opt('WinSearchChildren', 1)
;[Includes]
#include <Array.au3>
#include <File.au3>
#include <Misc.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <String.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
If _Singleton('OrganizeIncludes', 1) = 0 Then
MsgBox(16, 'Warning', 'An occurence of "Organize Includes" is already running', 5)
Exit (0)
EndIf
Global $start_T = TimerInit()
; ScriptVersion
Global $scriptVersion = 'Version 4.3', $date = '30.June.2008\n'
; ReleaseVersion
Global $InstallPath = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
Global $InstallVersion = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'Version')
; BetaVersion
Global $betaInstallPath = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'betaInstallDir')
Global $betaInstallVersion = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'betaVersion')
; Variables
Global $includesPathes_A[1]
Global $includesIni = @ScriptDir & '\includes.ini'
Global $source = '', $sourceAnalyse = '', $exit_B = 0, $organize_B = 0, $openIni_B = 0, $autoitVersion_I = 0, $betaVersion_I = 0, $filename_I = 0
Global $includes_LV = 0, $FileName = '', $GUI = 0, $status_SB = 0, $checkIncludes_B = 0, $ToBeIncluded[1], $B_DESCENDING = 0
Global $deleteIncludes_CB = 0, $copyToClipBoard_CB = 0, $delAll_R = 0, $delUnneeded_R = 0, $delNothing_R = 0, $keyword_I = 0
Global $placeAfterKeyWord_R = 0, $placeAtTop_R = 0, $green_A[1], $yellow_A[1], $red_A[1], $LV = 0, $count = 0, $silentMode_CB = 0
Global $parts_SB[3] = [80, 526, -1], $silentMode = True, $renewIni_B = 0, $addIncludePath_B = 0, $delIncludePath_B = 0, $restart_B = 0
Global $SciTECmd = 0, $My_Dec_Hwnd = 0, $Scite_hwnd = 0
Global $autoRestart_CB = 0, $udf_LV = 0, $FilePath = 0, $h_file = 0
Global $fileCount_A = 0, $release_R = 0, $beta_R = 0, $add = 75
Global $text_SB[3] = [@TAB & $scriptVersion, @TAB & 'Organize Includes', '']
Global $status_A[3] = ['correctly included', 'needed include', 'not needed']
Global $showProgress = 1
; Read the seetings from the ini file
Global $neededAndIncluded = IniRead($includesIni, 'Options', 'Green', 0x80FF80)
Global $neededNotIncluded = IniRead($includesIni, 'Options', 'Yellow', 0xFFFF80)
Global $notNeededButIncluded = IniRead($includesIni, 'Options', 'Red', 0xEF3D4A)
Global $keyword = IniRead($includesIni, 'Options', 'Keyword', ';[Includes]')
Global $includesFormatStart = IniRead($includesIni, 'Options', 'IncludesFormatStart', '#include<')
Global $includesFormatEnd = IniRead($includesIni, 'Options', 'IncludesFormatEnd', '>')
; In ini file = Release, Beta
Global $ReleaseOrBeta = IniRead($includesIni, 'Options', 'ReleaseOrBeta', 'Release')
Global $lastRUN = IniRead($includesIni, 'Options', 'LastRUN', "Release")
; MustDeclareVars
Global $nMsg
; **************************************************************
;~ #############################################################################"
;~ # la ligne ci dessous est place en commentaire pour ne pas afficher la barre
;~ If $showProgress Then ProgressOn('Organize Includes', 'Investigating includes ...', '0 %', @DesktopWidth / 2 - 150, 200, 1)
; Operating sequence
_createGUI()
; Get SciTE DirectorHandle
$Scite_hwnd = WinGetHandle('DirectorExtension')
GUIRegisterMsg($WM_COPYDATA, 'MY_WM_COPYDATA')
$My_Dec_Hwnd = Dec(StringTrimLeft($GUI, 2))
; clear Output
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:420')
; OI headline
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:+> "Organize Includes" for AutoIt3 | ' & $scriptVersion & ' | ' & Chr(169) & ' Th.Meger' & Chr(153) & ' | ' & $date)
_start()
; Setting silent off when 1 parameter = silentOff
; Silent mode = no GUI and organize includes automatically with settings from ini file
If $cmdLine[0] > 0 And $cmdLine[1] = 'silentOff' Then $silentMode = False
If GUICtrlRead($silentMode_CB) = $GUI_UNCHECKED Or $silentMode = False Then
If $showProgress Then ProgressSet(100, 'Done', 'Complete')
If $showProgress Then Sleep(200)
If $showProgress Then ProgressOff()
GUISetState(@SW_SHOW)
Else
_organize()
If $showProgress Then ProgressSet(100, 'Done', 'Complete')
If $showProgress Then Sleep(200)
If $showProgress Then ProgressOff()
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:104')
Exit (0)
EndIf
_GUICtrlStatusBar_SetText($status_SB, @TAB & StringFormat('%06.4f', Round(TimerDiff($start_T) / 1000, 4)) & ' sec', 2)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
FileClose($h_file)
Exit (0)
Case $exit_B
_exit()
Exit (0)
Case $organize_B
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Script started ... organizing includes ... ', 1)
_exit()
_organize()
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:104')
If GUICtrlRead($autoRestart_CB) = $GUI_CHECKED Then _restart()
Case $openIni_B
If FileExists($includesIni) Then
ShellExecute($includesIni)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'includes.ini opened', 1)
Else
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'No ini file found', 1)
Sleep(1000)
Local $re = MsgBox(36, 'Create new ini file', 'Do you want to create a new ini file?', 15)
If $re = -1 Or $re = 7 Then
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'No ini file available', 1)
ElseIf $re = 6 Then
_prepareOrganizeIncludes()
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'New ini file created', 1)
Sleep(2000)
If FileExists($includesIni) Then ShellExecute($includesIni)
EndIf
EndIf
Case $renewIni_B
_renewIni()
Case $placeAfterKeyWord_R
GUICtrlSetState($keyword_I, $GUI_SHOW)
GUICtrlSetState($keyword_I, $GUI_FOCUS)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Enter your keyword ...', 1)
Case $placeAtTop_R
GUICtrlSetState($keyword_I, $GUI_HIDE)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Includes will be placed at top of your script', 1)
Case $copyToClipBoard_CB
If GUICtrlRead($copyToClipBoard_CB) = $GUI_CHECKED Then
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Copying includes to clipboard activated', 1)
Else
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Copying includes to clipboard deactivated', 1)
EndIf
Case $includes_LV
_sortLV()
Case $delAll_R
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'All includes will be removed', 1)
Case $delUnneeded_R
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Only the not needed includes will be removed', 1)
Case $delNothing_R
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'No includes will be removed', 1)
Case $restart_B
$lastRUN = $ReleaseOrBeta
_prepareOrganizeIncludes()
_exit()
_restart()
Case $silentMode_CB
If GUICtrlRead($silentMode_CB) = $GUI_CHECKED Then
GUICtrlSetState($autoRestart_CB, $GUI_DISABLE)
GUICtrlSetState($autoRestart_CB, $GUI_UNCHECKED)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Silent Mode activated', 1)
Else
GUICtrlSetState($autoRestart_CB, $GUI_ENABLE)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Silent Mode deactivated', 1)
EndIf
Case $release_R
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Release version chosen!', 1)
$ReleaseOrBeta = 'Release'
If $ReleaseOrBeta <> $lastRUN Then
; @@@ 4.1 Wie steuere ich das nur beta oder nur Release includes untersucht werden?
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:420')
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> Creating new includes.ini - Release VERSION...\n')
_checkForReleaseOrBeta()
_prepareOrganizeIncludes()
_exit()
_restart()
EndIf
Case $beta_R
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Beta version chosen!', 1)
$ReleaseOrBeta = 'Beta'
If $ReleaseOrBeta <> $lastRUN Then
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:420')
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> Creating new includes.ini - BETA VERSION...\n')
_checkForReleaseOrBeta()
_prepareOrganizeIncludes()
_exit()
_restart()
EndIf
EndSwitch
WEnd
; Start func gets the source and calls all other needed funcs.
Func _start()
If Not ProcessExists('SciTE.exe') Then Exit (0)
Local $opt = Opt('WinTitleMatchMode', 4)
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'askfilename:')
$SciTECmd = StringReplace($SciTECmd, '\\', '\')
; ConsoleWrite($SciTECmd & @CRLF) ; Ausgabe kompletter Rückgabewert von askfilename:
$FilePath = StringTrimLeft($SciTECmd, StringInStr($SciTECmd, ':', Default, 3))
;~ MsgBox(0, '$FilePath', $FilePath) ; Ausgabe Dateipfad
;~ Exit
$FileName = StringSplit($SciTECmd, '\\')
;~ MsgBox(0, 'name', $FileName)
;SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:' & $FileName) ; Ausgabe des Dateinamens in die Console
GUICtrlSetData($filename_I, $FileName[UBound($FileName) - 1])
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:106')
Opt('WinTitleMatchMode', $opt)
; Open File
Local $h_file = FileOpen($FilePath, 0)
If $h_file = -1 Then
MsgBox(16, 'Error', 'Could not open file : ' & $FilePath, 5)
Exit (0)
EndIf
; Read file
$source = FileRead($h_file)
If @error > 0 Then
MsgBox(16, 'Error', 'Could not read file : ' & $FilePath, 5)
Exit (0)
EndIf
FileClose($h_file)
;#####################################################################################################
;# ajout par jl56
;#####################################################################################################
Local $koda="#Region ### START Koda GUI section ### Form="
;~ MsgBox(0, $FilePath, $source) ; Ausgabe des Quellcodes
local $result =StringInStr($source,$koda)
;~ MsgBox(0, "Search result:", $result)
if $result>0 Then
local $fichierkoda=""
local $ligne
$h_file = FileOpen($FilePath, 0)
While 1
$ligne=FileReadLine($h_file)
if StringLeft($ligne,StringLen($koda))=$koda then
$fichierkoda=StringRight($ligne,StringLen($ligne)-StringLen($koda))
ExitLoop
EndIf
WEnd
FileClose($h_file)
;~ MsgBox(0, "fichier koda",$fichierkoda&@crlf&@ScriptDir&"\fd.exe "&$fichierkoda)
Run(@ScriptDir&"\fd.exe "&$fichierkoda)
Else
Run(@ScriptDir&"\fd.exe")
endif
Exit
;##########################################################################################################
If Not FileExists($includesIni) Then
ConsoleWrite('!> Creating includes.ini ...' & @CRLF)
_prepareOrganizeIncludes()
_setOptions()
EndIf
_checkForReleaseOrBeta()
If $betaInstallPath = '' Then
GUICtrlSetState($release_R, $GUI_CHECKED)
GUICtrlSetState($beta_R, $GUI_DISABLE)
GUICtrlSetState($betaVersion_I, $GUI_DISABLE)
EndIf
GUICtrlSetData($autoitVersion_I, $InstallVersion)
GUICtrlSetData($betaVersion_I, $betaInstallVersion)
$ToBeIncluded = getIncludes()
_ArraySort($ToBeIncluded)
Local $re = setIncludes($ToBeIncluded)
If $re = -2 Then _GUICtrlStatusBar_SetText($status_SB, @TAB & 'No includes needed!', 1)
EndFunc ;==>_start
; Starting action (delete and/or insert)
Func _organize()
Local $sourceLine_A = StringSplit($source, @CR)
For $i = 1 To $sourceLine_A[0]
$sourceLine_A[$i] = StringReplace($sourceLine_A[$i], @LF, '')
Next
;~ _ArrayDisplay($sourceLine_A, 'vorher')
$sourceLine_A = _deleteIncludes($sourceLine_A)
$sourceLine_A = _insertIncludes($sourceLine_A)
;~ _ArrayDisplay($sourceLine_A, 'nachher')
; Änderungen in die Datei schreiben
Local $filehandle = FileOpen($FilePath, 2)
; Check if file opened for reading OK
If $filehandle = -1 Then
MsgBox(0, 'Error', 'Unable to open file: ' & $FileName & ' in write mode', 5)
Exit
EndIf
If FileWrite($filehandle, _ArrayToString($sourceLine_A, @CRLF, 1)) <> 1 Then
MsgBox(16, 'Error', 'Source has not been changed!', 5)
EndIf
FileClose($filehandle)
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Includes inserted', 1)
EndFunc ;==>_organize
; Insert includes into array of code lines
Func _insertIncludes($sourceLine_A)
Local $includes = ''
If GUICtrlRead($delAll_R) = $GUI_CHECKED Then $includes = _ArrayToString($green_A, @CRLF, 1)
$includes &= @CRLF & _ArrayToString($yellow_A, @CRLF, 1)
$includes = StringStripWS($includes, 3)
;~ ConsoleWrite($includes & @CRLF)
If GUICtrlRead($placeAfterKeyWord_R) = $GUI_CHECKED Then
Local $keyword = GUICtrlRead($keyword_I)
For $i = 0 To UBound($sourceLine_A) - 1
If StringInStr($sourceLine_A[$i], $keyword, 2) Then
_ArrayInsert($sourceLine_A, $i + 1, $includes)
ExitLoop
EndIf
Next
Else
If StringLen($includes) > 0 Then _ArrayInsert($sourceLine_A, 1, $includes)
EndIf
If GUICtrlRead($copyToClipBoard_CB) = $GUI_CHECKED Then
ClipPut('')
ClipPut($includes)
EndIf
Return $sourceLine_A
EndFunc ;==>_insertIncludes
; Delete includes from array of code lines
Func _deleteIncludes($sourceLine_A)
If GUICtrlRead($delAll_R) = $GUI_CHECKED Then
For $i = UBound($sourceLine_A) - 1 To 1 Step -1
; Wenn ';' include dann lasse die Zeile aus
If StringRegExp($sourceLine_A[$i], '(?i)#include[ ]*[<"' & "'][ ]*(.*?\.au3)(?=[ ]*[>'" & '"])', 0) = 1 And _
StringRegExp($sourceLine_A[$i], '(?i);.*[ ]*#include[ ]*[<"' & "']", 0) = 0 Then
_ArrayDelete($sourceLine_A, $i)
EndIf
Next
ElseIf GUICtrlRead($delUnneeded_R) = $GUI_CHECKED Then
For $ii = 1 To UBound($red_A) - 1
For $i = UBound($sourceLine_A) - 1 To 1 Step -1
If StringRegExp($sourceLine_A[$i], '(?i)#include[ ]*[<"' & "'][ ]*(.*?" & $red_A[$ii] & ')[ ]*[>"' & "']", 0) = 1 And _
StringRegExp($sourceLine_A[$i], '(?i);.*[ ]*#include[ ]*[<"' & "']", 0) = 0 Then
_ArrayDelete($sourceLine_A, $i)
EndIf
Next
Next
EndIf
Return $sourceLine_A
EndFunc ;==>_deleteIncludes
Func setIncludes($ToBeIncluded)
If Not IsArray($ToBeIncluded) Then Return -1
Local $pattern = '(?i)(?<=\n|\s|\A)#include[ ]*[<"' & "'][ ]*(.*?\.au3)(?=[ ]*[>'" & '"])'
_GUICtrlListView_SetItemCount($includes_LV, UBound($ToBeIncluded))
Dim $LV[150]
; Create a row for every include and set bk to green
;~ _ArrayDisplay($ToBeIncluded)
For $i = 1 To UBound($ToBeIncluded) - 1
$LV[$count] = GUICtrlCreateListViewItem($includesFormatStart & $ToBeIncluded[$i] & $includesFormatEnd & '|' & $status_A[0], $includes_LV)
GUICtrlSetBkColor(-1, $neededAndIncluded)
$count += 1
; Is the needed include is not in source code then change bk to yellow and delete entry from green array
If StringRegExp($source, '(?i)#include[ ]*[<"' & "'][ ]*" & $ToBeIncluded[$i] & '[ ]*' & "[>'" & '"]', 0) = 0 Or _
(StringRegExp($source, '(?i);.*[ ]*#include[ ]*[<"' & "'][ ]*" & $ToBeIncluded[$i] & '[ ]*' & "[>'" & '"]', 0) = 1 And _
StringRegExp($source, '(?i)#include[ ]*[<"' & "'][ ]*" & $ToBeIncluded[$i] & '[ ]*' & "[>'" & '"]', 0) = 0) Then
_GUICtrlListView_SetItemText($includes_LV, $i - 1, $status_A[1], 1)
;~ ConsoleWrite('> ' & $ToBeIncluded[$i] & @CRLF)
GUICtrlSetBkColor(-1, $neededNotIncluded)
_ArrayAdd($yellow_A, $ToBeIncluded[$i])
_ArrayDelete($green_A, _ArraySearch($green_A, $ToBeIncluded[$i]))
EndIf
Next
; Find all includes in source code. Bk to red if they are not needed
Local $alreadyIncluded = StringRegExp($source, $pattern, 3)
;~ If IsArray($alreadyIncluded) Then _ArrayDisplay($alreadyIncluded, 'Already')
If Not @error Then
For $i = 0 To UBound($alreadyIncluded) - 1
; @@@ change 4.1 auskommentiere includes wieder rausnehmen (Problem wenn benötigt und trotzdem auch auskommentiert!)
If _ArraySearch($ToBeIncluded, $alreadyIncluded[$i]) = -1 And _
StringRegExp($source, '(?i)[ ]*#include[ ]*[<"' & "'][ ]*" & $alreadyIncluded[$i] & '[ ]*' & "[>'" & '"]', 0) = 1 And _
StringRegExp($source, '(?i);.*[ ]*#include[ ]*[<"' & "'][ ]*" & $alreadyIncluded[$i] & '[ ]*' & "[>'" & '"]', 0) = 0 Then
$LV[$count] = GUICtrlCreateListViewItem($includesFormatStart & $alreadyIncluded[$i] & $includesFormatEnd & '|' & $status_A[2], $includes_LV)
GUICtrlSetBkColor(-1, $notNeededButIncluded)
$count += 1
_ArrayAdd($red_A, $alreadyIncluded[$i])
EndIf
Next
EndIf
For $i = 1 To UBound($green_A) - 1
$green_A[$i] = $includesFormatStart & $green_A[$i] & $includesFormatEnd
Next
For $i = 1 To UBound($yellow_A) - 1
$yellow_A[$i] = $includesFormatStart & $yellow_A[$i] & $includesFormatEnd
Next
; Testausgabe für bereits includierte Includes
;~ _ArrayDisplay($alreadyIncluded, 'Bereits drin')
If UBound($ToBeIncluded) = 1 Then Return -2
EndFunc ;==>setIncludes
; If version number (Release and beta) changed or ini file doesn't exist then create a new one with _prepareOrganizeIncludes()
; Search for needed includes
Func getIncludes()
; Für alle IncludeFolder checken ob sich die Anzahl der au3 Dateien geändert hat. Wenn ja, dann
; soll _prepareOrganizeIncludes() aufgerufen werden
If FileExists($includesIni) = 0 Or _
(IniRead($includesIni, 'Version', 'Beta', 'Error') <> $betaInstallVersion) Or _
(IniRead($includesIni, 'Version', 'Release', 'Error') <> $InstallVersion) Or _
_checkIncludePathes() Then
_prepareOrganizeIncludes()
EndIf
;ConsoleWrite('returnCode : ' & _checkIncludePathes() & @CRLF)
Local $lines_A, $re
If Not _FileReadToArray($includesIni, $lines_A) Then
MsgBox(4096, '', 'Error occurred, probably no ini file.')
Exit
EndIf
Local $iniContentConstants[1][2]
Local $iniContentFunctions[1][2]
Local $countConstants = 1
Local $countFunctions = 1
For $i = 1 To UBound($lines_A) - 1
; @@@ 4.1 Änderung auf Konstanten und Funktionen
If StringInStr($lines_A[$i], '.au3') And StringInStr($lines_A[$i], 'Constants') Then
$re = StringSplit($lines_A[$i], '=')
ReDim $iniContentConstants[$countConstants + 1][2]
$iniContentConstants[$countConstants][0] = $re[1]
$iniContentConstants[$countConstants][1] = $re[2]
$countConstants += 1
ElseIf StringInStr($lines_A[$i], '.au3') Then
$re = StringSplit($lines_A[$i], '=')
ReDim $iniContentFunctions[$countFunctions + 1][2]
$iniContentFunctions[$countFunctions][0] = $re[1]
$iniContentFunctions[$countFunctions][1] = $re[2]
$countFunctions += 1
EndIf
Next
;~ _ArrayDisplay($iniContentConstants)
;~ _ArrayDisplay($iniContentFunctions)
$iniContentConstants[0][0] = UBound($iniContentConstants) - 1
$iniContentFunctions[0][0] = UBound($iniContentFunctions) - 1
Local $iniContent = $iniContentConstants[0][0] + $iniContentFunctions[0][0]
Local $checkGUIRegisterMsg = 0, $percent = 0
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> ' & _StringRepeat('-', 100) & '\n')
If StringRegExp($source, '(?i)GUIRegisterMsg[ ]*\(') Then $checkGUIRegisterMsg = 1
; Check all the functions
For $i = 1 To $iniContentFunctions[0][0]
If $showProgress Then ProgressSet(Round(($i * 100 / $iniContent)), StringFormat('%05.2f', Round(($i * 100 / $iniContent), 2)) & ' %')
; Wenn nur eine Funktion enthalten ist ohne ; dann muss dies geprüft werden
Local $functionsInAU3 = StringSplit($iniContentFunctions[$i][1], ';')
If @error Then
If StringRegExp($source, '(?i)' & $iniContentFunctions[$i][0] & '([ ]+|\()', 0) = 1 Then
_ArrayAdd($ToBeIncluded, $iniContentFunctions[$i][0])
ExitLoop
EndIf
EndIf
If $checkGUIRegisterMsg Then
For $ii = 1 To UBound($functionsInAU3) - 1
If StringRegExp($source, '(?i)GUIRegisterMsg[ ]*\([ ]*.*(["' & "']+\b" & $functionsInAU3[$ii] & "\b['" & '"]+[ ]*)') = 1 Then
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:+> ' & $functionsInAU3[$ii] & _StringRepeat(' ', 50 - StringLen($functionsInAU3[$ii])) & Chr(151) & '> ' & $iniContentFunctions[$i][0] & '\n')
_ArrayAdd($ToBeIncluded, $iniContentFunctions[$i][0])
ExitLoop
EndIf
Next
EndIf
; @@@ 4.1 Unterscheidung einbauen ob nach einer Funktion oder einer Konstanten gesucht wird
; Suche nach Funktionen
For $ii = 1 To UBound($functionsInAU3) - 1
If StringRegExp($source, '(?i)[^\w\$]\b' & $functionsInAU3[$ii] & '\b([ ]*)\(', 0) = 1 Then
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:+> ' & $functionsInAU3[$ii] & _StringRepeat(' ', 50 - StringLen($functionsInAU3[$ii])) & Chr(151) & '> ' & $iniContentFunctions[$i][0] & '\n')
_ArrayAdd($ToBeIncluded, $iniContentFunctions[$i][0])
ExitLoop
EndIf
Next
$percent = $i
Next
; Check all the constants
For $i = 1 To $iniContentConstants[0][0]
If $showProgress Then ProgressSet(Round(($percent * 100 / $iniContent)), StringFormat('%05.2f', Round(($percent * 100 / $iniContent), 2)) & ' %')
; Wenn nur eine Konstante enthalten ist ohne ; dann muss dies geprüft werden
Local $constantsInAU3 = StringSplit($iniContentConstants[$i][1], ';')
If @error Then
If StringRegExp($source, '(?i)\' & $iniContentConstants[$i][0] & '(?=\W)', 0) = 1 Then
_ArrayAdd($ToBeIncluded, $iniContentConstants[$i][0])
ExitLoop
EndIf
EndIf
; Suche nach Konstanten
For $ii = 1 To UBound($constantsInAU3) - 1
If StringRegExp($source, '(?i)\W\' & $constantsInAU3[$ii] & '(?=\W)', 0) = 1 Then
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:+> ' & $constantsInAU3[$ii] & _StringRepeat(' ', 50 - StringLen($constantsInAU3[$ii])) & Chr(151) & '> ' & $iniContentConstants[$i][0] & '\n')
_ArrayAdd($ToBeIncluded, $iniContentConstants[$i][0])
ExitLoop
EndIf
Next
$percent += 1
Next
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> ' & _StringRepeat('-', 100) & '\n')
; @@@ 4.2
;~ _ArrayDisplay($ToBeIncluded, "2bincluded")
Local $re = _ArraySearch($ToBeIncluded, GUICtrlRead($filename_I))
If $re <> -1 Then
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> ' & $ToBeIncluded[$re] & ' selfinclude deleted' & '\n')
_ArrayDelete($ToBeIncluded, $re)
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'output:!> ' & _StringRepeat('-', 100) & '\n')
EndIf
$green_A = $ToBeIncluded
Return $ToBeIncluded
EndFunc ;==>getIncludes
Func _setOptions()
; Version info
IniWrite($includesIni, 'Version', 'Beta', $betaInstallVersion)
IniWrite($includesIni, 'Version', 'Release', $InstallVersion)
; Options
IniWrite($includesIni, 'Options', 'Green', '0x80FF80')
IniWrite($includesIni, 'Options', 'Yellow', '0xFFFF80')
IniWrite($includesIni, 'Options', 'Red', '0xEF3D4A')
IniWrite($includesIni, 'Options', 'Keyword', ';[Includes]')
IniWrite($includesIni, 'Options', 'CopyToCliP', 0)
IniWrite($includesIni, 'Options', 'Del', 0)
IniWrite($includesIni, 'Options', 'Place', 0)
IniWrite($includesIni, 'Options', 'SilentMode', 0)
IniWrite($includesIni, 'Options', 'AutoRestart', 1)
IniWrite($includesIni, 'Options', 'LastRUN', 2)
IniWrite($includesIni, 'Options', 'ReleaseOrBeta', "Release")
IniWrite($includesIni, 'Options', 'IncludesFormatStart', '#include <')
IniWrite($includesIni, 'Options', 'IncludesFormatEnd', '>')
IniWrite($includesIni, 'UDF_Include_Pathes', 'MyUDFPath1', '')
IniWrite($includesIni, 'UDF_Include_Pathes', 'MyUDFPath2', '')
IniWrite($includesIni, 'UDF_Include_Pathes', 'MyUDFPath3', '')
IniWrite($includesIni, 'UDF_Include_Pathes', 'MyUDFPath4', '')
IniWrite($includesIni, 'Options', 'Created', @YEAR & '/' & @MON & '/' & @MDAY & ' - ' & @HOUR & ':' & @MIN & ':' & @SEC)
EndFunc ;==>_setOptions
; Create new includes.ini with funcs and seetings/options
Func _prepareOrganizeIncludes()
; ConsoleWrite('_prepareOrganizeIncludes ' & @CRLF)
; Includes
IniDelete($includesIni, 'Functions')
IniDelete($includesIni, 'Constants')
Local $functions, $FileList
For $ii = 0 To UBound($includesPathes_A) - 1
$FileList = _FileListToArray($includesPathes_A[$ii], '*.au3', 1)
If @error = 1 Then ContinueLoop
For $i = 1 To UBound($FileList) - 1
If StringInStr($FileList[$i], 'Constants') = 0 Then
; Untersuchung der Funktionen
;ConsoleWrite($i & ' : ' & $includesPathes_A[$ii] & $FileList[$i] & @CRLF)
$functions = StringRegExp(FileRead(FileOpen($includesPathes_A[$ii] & $FileList[$i], 0)), '(?i)(?<=Func )[0-9a-zA-Z_]+[ ]*(?=\()', 3)
If IsArray($functions) And UBound($functions) > 1 Then
IniWrite($includesIni, 'Functions', $FileList[$i], _ArrayToString($functions, ';'))
ElseIf IsArray($functions) Then
IniWrite($includesIni, 'Functions', $FileList[$i], $functions[0])
EndIf
Else
; Untersuchung der Konstanten
;ConsoleWrite($i & ' x: ' & $includesPathes_A[$ii] & $FileList[$i] & @CRLF)
$functions = StringRegExp(FileRead(FileOpen($includesPathes_A[$ii] & $FileList[$i], 0)), '(?i)(?<=Global Const )\$\w*', 3)
If IsArray($functions) And UBound($functions) > 1 Then
IniWrite($includesIni, 'Constants', $FileList[$i], _ArrayToString($functions, ';'))
ElseIf IsArray($functions) Then
IniWrite($includesIni, 'Constants', $FileList[$i], $functions[0])
EndIf
EndIf
Next
Next
IniWrite($includesIni, 'Options', 'Created', @YEAR & '/' & @MON & '/' & @MDAY & ' - ' & @HOUR & ':' & @MIN & ':' & @SEC)
_saveIncludePathesToIni()
EndFunc ;==>_prepareOrganizeIncludes
; Create the GUI
Func _createGUI()
$GUI = GUICreate('Organize Includes for AutoIt by Xenobiologist', 606, 646, @DesktopWidth / 2 - 303, 50, $WS_SYSMENU)
GUICtrlCreateGroup('Includes', 8, 158, 585, 368)
$includes_LV = GUICtrlCreateListView('Includes|Status', 24, 187, 553, 321)
GUICtrlSendMsg($includes_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($includes_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($includes_LV)]
GUICtrlSetFont($includes_LV, 10, 600, '', 'Trebuchet MS')
_GUICtrlListView_SetColumnWidth($includes_LV, 0, 400)
_GUICtrlListView_SetColumnWidth($includes_LV, 1, $LVSCW_AUTOSIZE_USEHEADER)
GUICtrlCreateGroup('', -99, -99, 1, 1)
GUICtrlCreateLabel('AutoIt', 8, 16, 100, 21, $SS_SUNKEN)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 12, 700)
$autoitVersion_I = GUICtrlCreateInput('', 113, 16, 81, 21)
GUICtrlCreateLabel('AutoIt beta', 203, 16, 100, 21, $SS_SUNKEN)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 12, 700)
$betaVersion_I = GUICtrlCreateInput('', 309, 16, 81, 21)
GUICtrlCreateLabel('Filename', 8, 40, 100, 21, $SS_SUNKEN)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 12, 700)
$filename_I = GUICtrlCreateInput('', 113, 40, 278, 21)
GUICtrlCreatePic($InstallPath & '\Examples\GUI\logo4.gif', 400, 16, 190, 45)
GUICtrlCreateGroup('Options', 8, 68, 585, 88)
$organize_B = GUICtrlCreateButton('Organize includes', 8, 562, 187, 25, 0)
GUICtrlSetTip(-1, 'Start organize includes', 'Start script', 1, 1)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 11, 600)
$openIni_B = GUICtrlCreateButton('Open ini', 200, 562, 100, 25, 0)
GUICtrlSetTip(-1, 'Options and settings for the "Organize Includes" script', 'Open ini file', 1, 1)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 11, 600)
$renewIni_B = GUICtrlCreateButton('Renew ini', 303, 562, 100, 25, 0)
GUICtrlSetTip(-1, 'New scan for funcs in include folders', 'Renew ini file', 1, 1)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 11, 600)
$exit_B = GUICtrlCreateButton('Exit', 408, 562, 187, 25, 0)
GUICtrlSetTip(-1, 'Exit' & @TAB & @TAB & @TAB & '- settings will be saved' & @CRLF & _
'Exit without saving' & @TAB & '- by leaving with the cross', 'Exit script', 1, 1)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 11, 600)
$status_SB = _GUICtrlStatusBar_Create($GUI, $parts_SB, $text_SB)
GUIStartGroup()
$delAll_R = GUICtrlCreateRadio('Remove all', 22, $add + 16, 120, 15)
GUICtrlSetTip(-1, 'Remove all' & @TAB & @TAB & ' - remove all includes of your script' & @CRLF & _
'Remove unneeded ' & @TAB & ' - remove all not needed includes of your script' & @CRLF & _
'Remove nothing ' & @TAB & ' - do not remove includes of your script', 'Remove includes', 1, 1)
$delUnneeded_R = GUICtrlCreateRadio('Remove unneeded', 22, $add + 32, 120, 15)
$delNothing_R = GUICtrlCreateRadio('Remove nothing', 22, $add + 48, 120, 15)
GUIStartGroup()
Switch IniRead($includesIni, 'Options', 'Del', '0')
Case 0
GUICtrlSetState($delAll_R, $GUI_CHECKED)
Case 1
GUICtrlSetState($delUnneeded_R, $GUI_CHECKED)
Case 2
GUICtrlSetState($delNothing_R, $GUI_CHECKED)
EndSwitch
GUIStartGroup()
$placeAfterKeyWord_R = GUICtrlCreateRadio('Place after keyword', 175, $add + 16, 120, 15)
GUICtrlSetTip(-1, 'Insert the inculdes at top of your script or' & @CRLF & _
'place the includes after a special keyword.', 'Insert includes', 1, 1)
$placeAtTop_R = GUICtrlCreateRadio('Place at top', 175, $add + 32, 120, 15)
GUIStartGroup()
$keyword_I = GUICtrlCreateInput(IniRead($includesIni, 'Options', 'Keyword', ';[includes]'), 175, $add + 50, 113, 15)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetFont(-1, 7, 1700)
GUICtrlSetTip(-1, 'Keyword to search for. Includes are placed after this line.', 'Keyword', 1, 1)
If IniRead($includesIni, 'Options', 'Place', '0') = 1 Then
GUICtrlSetState($placeAtTop_R, $GUI_CHECKED)
GUICtrlSetState($keyword_I, $GUI_HIDE)
Else
GUICtrlSetState($placeAfterKeyWord_R, $GUI_CHECKED)
GUICtrlSetState($keyword_I, $GUI_SHOW)
EndIf
$copyToClipBoard_CB = GUICtrlCreateCheckbox('Copy to clipboard', 345, $add + 16, 120, 15)
GUICtrlSetTip(-1, 'Copy the includes to clipboard.', 'Copy to clipboard', 1, 1)
If IniRead($includesIni, 'Options', 'CopyToClip', '0') = 1 Then GUICtrlSetState($copyToClipBoard_CB, $GUI_CHECKED)
$autoRestart_CB = GUICtrlCreateCheckbox('AutoRestart', 345, $add + 32, 120, 15)
GUICtrlSetTip(-1, 'AutoRestart ' & @TAB & '- Automatically restarts script after pressing organize includes button', 'AutoRestart', 1, 1)
If IniRead($includesIni, 'Options', 'AutoRestart', '0') = 1 Then GUICtrlSetState($autoRestart_CB, $GUI_CHECKED)
$silentMode_CB = GUICtrlCreateCheckbox('Silent Mode', 345, $add + 48, 120, 15)
GUICtrlSetTip(-1, 'Checked ' & @TAB & '- Next start will do an oragnize includes without GUI.' & @CRLF & _
'Once checked and restarted you can only deacitvate silent mode by changend value in the ini to SilentMode=0 or ' & @CRLF & _
'by starting the script with parameter silentOff.', 'Silent Mode', 1, 1)
If IniRead($includesIni, 'Options', 'SilentMode', '0') = 1 Then GUICtrlSetState($silentMode_CB, $GUI_CHECKED)
$restart_B = GUICtrlCreateButton('Restart/Refresh', 200, 535, 203, 19)
GUICtrlSetTip(-1, 'Restarts "organize includes". Behaves like a refresh.', 'Restart/Refresh', 1, 1)
; @@@ 4.1 ToolTipps überarbeiten!!!
GUIStartGroup()
$release_R = GUICtrlCreateRadio('Use Release', 490, $add + 16, 100, 15)
GUICtrlSetTip($release_R, 'Use Release version for organizing includes', 'Search for keywords in "Release Version"', 1, 1)
$beta_R = GUICtrlCreateRadio('Use Beta', 490, $add + 32, 100, 15)
GUICtrlSetTip($beta_R, 'Use Beta version for organizing includes', 'Search for keywords in "Beta Version"', 1, 1)
GUIStartGroup()
GUICtrlSetState($release_R, $GUI_CHECKED)
Switch $lastRUN
Case "Release"
GUICtrlSetState($release_R, $GUI_CHECKED)
GUICtrlSetState($beta_R, $GUI_UNCHECKED)
Case "Beta"
GUICtrlSetState($release_R, $GUI_UNCHECKED)
GUICtrlSetState($beta_R, $GUI_CHECKED)
EndSwitch
EndFunc ;==>_createGUI
; Save seetings before exit
Func _exit()
If GUICtrlRead($placeAfterKeyWord_R) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'Keyword', GUICtrlRead($keyword_I))
EndIf
If GUICtrlRead($copyToClipBoard_CB) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'CopyToClip', 1)
Else
IniWrite($includesIni, 'Options', 'CopyToClip', 0)
EndIf
If GUICtrlRead($delAll_R) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'Del', 0)
ElseIf GUICtrlRead($delUnneeded_R) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'Del', 1)
ElseIf GUICtrlRead($delNothing_R) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'Del', 2)
EndIf
If GUICtrlRead($placeAfterKeyWord_R) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'Place', 0)
Else
IniWrite($includesIni, 'Options', 'Place', 1)
EndIf
If GUICtrlRead($silentMode_CB) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'SilentMode', 1)
Else
IniWrite($includesIni, 'Options', 'SilentMode', 0)
EndIf
If GUICtrlRead($autoRestart_CB) = $GUI_CHECKED Then
IniWrite($includesIni, 'Options', 'AutoRestart', 1)
Else
IniWrite($includesIni, 'Options', 'AutoRestart', 0)
EndIf
If $InstallVersion <> IniWrite($includesIni, 'Version', 'Release', $InstallVersion) Then
IniWrite($includesIni, 'Version', 'Release', $InstallVersion)
EndIf
If $betaInstallVersion = IniWrite($includesIni, 'Version', 'Beta', $betaInstallVersion) Then
IniWrite($includesIni, 'Version', 'Beta', $betaInstallVersion)
EndIf
IniWrite($includesIni, 'Options', 'LastRUN', $ReleaseOrBeta)
IniWrite($includesIni, 'Options', 'ReleaseOrBeta', $ReleaseOrBeta)
EndFunc ;==>_exit
; Sort the listview items
Func _sortLV()
Local $iCol[2] = [0]
_GUICtrlListView_SimpleSort($includes_LV, $B_DESCENDING, $iCol)
For $i = 0 To $count - 1
Switch _GUICtrlListView_GetItemText($includes_LV, $i, 1)
Case $status_A[0]
GUICtrlSetBkColor($LV[$i], $neededAndIncluded)
Case $status_A[1]
GUICtrlSetBkColor($LV[$i], $neededNotIncluded)
Case $status_A[2]
GUICtrlSetBkColor($LV[$i], $notNeededButIncluded)
EndSwitch
Next
EndFunc ;==>_sortLV
Func _restart()
SendSciTE_Command($My_Dec_Hwnd, $Scite_hwnd, 'menucommand:420')
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Script is restarting ...', 1)
Run('"' & @AutoItExe & '" ' & '/AutoIt3ExecuteScript "' & @ScriptFullPath & '" ' & @AutoItPID, '', @SW_HIDE)
Exit (0)
EndFunc ;==>_restart
Func _renewIni()
If IniDelete($includesIni, 'Functions') And IniDelete($includesIni, 'Constants') Then
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'Funcs in includes.ini deleted', 1)
Local $includePathSection = IniReadSection($includesIni, 'IncludePath')
If Not @error Then
For $i = 1 To $includePathSection[0][0]
If _ArraySearch($includesPathes_A, $includePathSection[$i][0] & '\') = -1 Then
_ArrayInsert($includesPathes_A, 0, $includePathSection[$i][0] & '\')
EndIf
Next
EndIf
_prepareOrganizeIncludes()
Else
_GUICtrlStatusBar_SetText($status_SB, @TAB & 'includes.ini could not be renewed', 1)
EndIf
EndFunc ;==>_renewIni
Func _saveIncludePathesToIni()
For $i = 1 To UBound($includesPathes_A) - 1
$fileCount_A = _FileListToArray($includesPathes_A[$i], '*.au3', 1)
; Wenn keine der Pfad nicht existiert
If @error = 1 Then
MsgBox(16, 'Error', 'Invalid path for include location : ' & $includesPathes_A[$i], 10)
Exit (0)
EndIf
; Wenn keine au3 Datei gefunden wird - Wert auf 0 setzen
If @error = 4 Then IniWrite($includesIni, 'IncludePathes', $includesPathes_A[$i], '')
IniWrite($includesIni, 'IncludePathes', $includesPathes_A[$i], StringReplace(_ArrayToString($fileCount_A, ';', 1), '.au3', ''))
Next
EndFunc ;==>_saveIncludePathesToIni
Func _checkIncludePathes()
Local $pathes_A = IniReadSection($includesIni, 'IncludePathes')
If @error Then Return -1
; Wenn einer der Pfade aus dem Code nicht drin in der ini ist, dann neu machen
For $i = 1 To UBound($includesPathes_A) - 1
If _ArraySearch($pathes_A, $includesPathes_A[$i], 1, 0, 0, 0, 1, 0) = -1 Then
IniDelete($includesIni, 'IncludePathes')
ConsoleWrite('!> Creating includes.ini ...' & @CRLF)
Return 3
EndIf
Next
; Wenn einer der Pfade aus dem Ini nicht im Code ist, dann neu machen
For $i = 1 To UBound($pathes_A, 1) - 1
If _ArraySearch($includesPathes_A, $pathes_A[$i][0], 1, 0, 0, 0, 1, 0) = -1 Then
IniDelete($includesIni, 'IncludePathes')
ConsoleWrite('!> Creating includes.ini ...' & @CRLF)
Return 3
EndIf
Next
For $i = 1 To UBound($includesPathes_A) - 1
$fileCount_A = _FileListToArray($includesPathes_A[$i], '*.au3', 1)
; Wenn einer der Pfad nicht existiert
If @error Then Return 1
If IniRead($includesIni, 'IncludePathes', $includesPathes_A[$i], '') <> StringReplace(_ArrayToString($fileCount_A, ';', 1), '.au3', '') Then
ConsoleWrite('!> Creating includes.ini ...' & @CRLF)
Return 1
EndIf
Next
Return 0
EndFunc ;==>_checkIncludePathes
Func _checkForReleaseOrBeta()
$includesPathes_A = 0
Global $includesPathes_A[1]
Switch $ReleaseOrBeta
Case 'Beta'
If $betaInstallPath <> '' Then
_ArrayAdd($includesPathes_A, $betaInstallPath & '\Include\')
_addUDFsToArray()
Return 'Beta'
Else
MsgBox(16, 'Error', 'Wrong flag for $ReleaseOrBeta!' & @CRLF & @CRLF & 'Beta version of Autoit not found!', 5)
_ArrayAdd($includesPathes_A, $InstallPath & '\Include\')
_addUDFsToArray()
Return 'Release'
EndIf
Case 'Release'
_ArrayAdd($includesPathes_A, $InstallPath & '\Include\')
_addUDFsToArray()
Return 'Release'
Case Else
MsgBox(16, 'Error', 'Wrong flag for $ReleaseOrBeta!' & @CRLF & @CRLF & 'Please select Release or Beta', 5)
Exit (0)
EndSwitch
EndFunc ;==>_checkForReleaseOrBeta
; Send command to SciTE
Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd)
$sCmd = ':' & $My_Dec_Hwnd & ':' & $sCmd
ConsoleWrite('-->' & $sCmd & @LF)
Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
DllStructSetData($CmdStruct, 1, $sCmd)
Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
DllStructSetData($COPYDATA, 1, 1)
DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _
'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
'Ptr', DllStructGetPtr($COPYDATA))
EndFunc ;==>SendSciTE_Command
; Received Data from SciTE
Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam)
Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam)
Local $SciTECmdLen = DllStructGetData($COPYDATA, 2)
Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3))
$SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
EndFunc ;==>MY_WM_COPYDATA
Func _addUDFsToArray()
Local $udfIncludesPathes_A = IniReadSection($includesIni, 'UDF_Include_Pathes')
If @error = 1 Then
MsgBox(16, 'Error', 'Unable to read UDF_Include_Pathes section.' & @CRLF & @CRLF & 'Please renew includes.ini file.', 10)
Else
For $i = 1 To $udfIncludesPathes_A[0][0]
If FileExists($udfIncludesPathes_A[$i][1]) = 1 Then
_ArrayAdd($includesPathes_A, $udfIncludesPathes_A[$i][1])
ElseIf StringLen($udfIncludesPathes_A[$i][1]) > 1 And FileExists($udfIncludesPathes_A[$i][1]) = 0 Then
MsgBox(16, 'Error', 'UDF_Include_Pathes : ' & $udfIncludesPathes_A[$i][0] & ' does not exist.' & @CRLF & @CRLF & 'Please fix includes.ini file.', 10)
If FileExists($includesIni) Then ShellExecute($includesIni)
ExitLoop
EndIf
Next
EndIf
EndFunc ;==>_addUDFsToArray