Jump to content

AutoIt Syntax Highlight


MrCreatoR
 Share

Recommended Posts

This UDF allows to highlight AutoIt v3 syntax code to html/bbcode format.

Note: As strange as it might sound, this UDF written on pure AutoIt (even includes are not used), and since this UDF uses a lot of RegExp, i had to add a RegExp debugging system.
To enable this system you should set «1» for the following variables in library file (AutoItSyntaxHighlight.au3) under the #Region Global Variables:

Removed starting from version 1.1

Global $fAu3SH_Debug_RE_Patterns = True ; Enable regular expression debugging system
Global $fAu3SH_Debug_RE_WriteLog = True ; Will write a log-file for debugging data (at the end of each syntax highlighting process)

There is also a Global option to define if the functions/keywords should be linked to online documentation:

$AU3SH_ADD_URLS = 1 ; Will add links to highlighted Functions/Keywords

Example:

Spoiler

 

#include <Au3SyntaxHighlight.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$AU3SH_ADD_URLS = 1

$sInitDir = ''
$sFilter = '*.au3'

$sMRUList = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\au3', 'MRUList')
$sLastFileOpenPath = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\au3', StringLeft($sMRUList, 1))

If Not FileExists($sLastFileOpenPath) Then
    $sInitDir = @ScriptDir
    $sFilter = 'Test Script.au3'
EndIf

$sFile = FileOpenDialog('Open Au3 Script File', $sInitDir, 'AutoIt Script (' & $sFilter & ')')
If @error Then Exit

$sAu3Code = FileRead($sFile)
$sAu3Syntax_HighlightedCode = _Au3_SyntaxHighlight_Proc($sAu3Code, 0)

$sTmp_File = @TempDir & '\Au3_HighlightSyntax.htm'

$hFile = FileOpen($sTmp_File, 2)
FileWrite($hFile, $sAu3Syntax_HighlightedCode)
FileClose($hFile)

_IEErrorHandlerRegister()

$oIE = _IECreateEmbedded()

$iGUI_Width = @DesktopWidth - 40
$iGUI_Height = @DesktopHeight - 150

$hGUI = GUICreate('AutoIt Syntax Highlighter [' & $sFile & ']', $iGUI_Width, $iGUI_Height, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
GUICtrlCreateObj($oIE, 10, 20, $iGUI_Width - 20, $iGUI_Height - 70)
$iBack_Bttn = GUICtrlCreateButton('Back', 10, $iGUI_Height - 40, 100, 30)
$iForward_Bttn = GUICtrlCreateButton('Forward', 120, $iGUI_Height - 40, 100, 30)
$iHome_Bttn = GUICtrlCreateButton('Home', 230, $iGUI_Height - 40, 100, 30)
$iStop_Bttn = GUICtrlCreateButton('Stop', 340, $iGUI_Height - 40, 100, 30)

GUISetState(@SW_SHOW, $hGUI)

_IENavigate($oIE, $sTmp_File)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            Exit
        Case $iHome_Bttn
            _IENavigate($oIE, $sTmp_File)
        Case $iBack_Bttn
            _IEAction($oIE, 'back')
        Case $iForward_Bttn
            _IEAction($oIE, 'forward')
        Case $iStop_Bttn
            _IEAction($oIE, 'stop')
    EndSwitch
WEnd

 



UDF Header:

Spoiler
; #FUNCTION# ====================================================================================================
; Name...........:  _Au3_SyntaxHighlight
; Description....:  Allows to highlight AutoIt v3 syntax to html/bbcode format.
; Syntax.........:  _Au3_SyntaxHighlight($sAu3Code [, $iOutput = -1])
; Parameters.....:  $sAu3Code - AutoIt v3 plain code.
;                   $iOutput  - [Optional] Sets the output format:
;                                                         -1 - (Default) Return CSS classes header and the AutoIt Syntax Highlighted code as string (wrapped with code tags)
;                                                          1 - Return CSS classes header and AutoIt Syntax Highlighted code as array, where...
;                                                               [0] = CSS styles.
;                                                               [1] = AutoIt Syntax Highlighted code.
;                                                          2 - Return the result as Html formatted string.
;                                                          3 - Return the result as BBCode formatted string (html tags replaced with bbcode tags).
;                   
; Return values..:  Success - Returns AutoIt Syntax Highlighted code (see $iOutput parameter above for more details).
;                   Failure - Sets @error to:
;                                               1   - The $sAu3Code is empty string.
;                                              -1   - The process is aborted by user parameter $AU3SH_HIGHLIGHT_ABORT, and the return value is the original $sAu3Code.
;                                               2   - Keywords or styles file not found (check the @ScriptDir & "\Resources").
;
; Author.........:  G.Sandler (a.k.a (Mr)CreatoR), www.creator-lab.ucoz.ru, www.autoit-script.ru
; Modified.......:  
; Remarks........:  *Idea* based on similar old project: http://www.autoitscript.com/forum/index.php?showtopic=34236
; Related........:  
; Link...........:  
; Example........:  Yes (see #Region Header).
; ===============================================================================================================

 



Current Library Version: 1.2
AutoIt Support Version: v3.3+, Developed/Tested on Win XP Rus (Service Pack 3) / Win 7 Rus

Screenshot:
AutoItSyntaxHighlight.png

Credits:

Spoiler

amel27


Change Log:

Spoiler

[1.2]
+ Added Keywords and API multi files support
    ($AU3SH_KEYWORDS_FILE and $AU3SH_API_FILE can contain more than one file path, delimited with ;)
+ Added $AU3SH_KEYWORDS_FUNCS/UDFS/KWRDS/MACROS/PREPROC/SPECIAL/SNDKEYS user variables to set properties keys to be read from $AU3SH_KEYWORDS_FILE files.
    (can be delimited with ; to set multiple keys (first found will be used))
* Fixed send keys highlighting.
* Fixed highlighting strings that is used as unique strings to replace strings (such as '%@~@%').

[1.1] @THIS IS SCRIPT BREAKING VERSION@
* $iAu3SH_AddURLs renamed to $AU3SH_ADD_URLS.
* $iAu3SH_AbortHighlight renamed to $AU3SH_HIGHLIGHT_ABORT.
    ATTENTION: If this is set to True, then it's should be reset to False after the "_Au3_SyntaxHighlight" function returns.
+ Added new user variables to set urls when using $AU3SH_ADD_URLS: $AU3SH_FUNCS_URL, $AU3SH_UDFS_URL, $AU3SH_KEYWORDS_URL, $AU3SH_MACROS_URL, $AU3SH_PREPROC_URL.
+ Added $AU3SH_KEYWORDS_FILE user variable to specify path to au3.keywords.properties file, if not found used one from Resources dir (can be outdated).
+ Added $AU3SH_API_FILE user variable to specify path to au3.api file, if not found used one from Resources dir (can be outdated).
* _Au3_SyntaxHighlight_Proc renamed to _Au3_SyntaxHighlight.
* Function names was shorten.
* Speed optimization.
- Removed debug system ($fAu3SH_Debug_RE_Patterns and $fAu3SH_Debug_RE_WriteLog also have been removed).

[1.0]
* Speed optimization.

[0.9]
+ Compatibility with AutoIt 3.3.12.0.
+ Added "Add missing keywords.au3" script to add missing keywords from new AutoIt version.
* $iDebug_RegExp_Patterns user global variable renamed to $fAu3SH_Debug_RE_Patterns.
* $iDebug_RegExp_WriteLog user global variable renamed to $fAu3SH_Debug_RE_WriteLog.
* Examples changed.

[0.8]
* Fixed bug with highlighting variables inside special keywords (#region, #forceref etc.).

[0.7]
* Fixed issue with wrong parsing when Add Urls option is enabled.

[0.6]
+ Compatibility with AutoIt 3.3.8.1.
* Fixed issue with wrong restored strings.
* Fixed bug with not proper UDF naming for url (UDFs links does not recognized due to not proper case, i.e: _stringrepeat instead of _StringRepeat).

[0.5]
* Fixed bug with highlighting literal strings inside comment blocks.
* Fixed few issues with highlighting special keywords.

[0.4]
* Fixed bug with (re)highlighting keywords and functions inside COM object methods.
* Docs updated.

[0.3]
* Fixed bug when strings and send keys was highlighted inside commented lines.
* Few optimizations to the code.

[0.2]
+ Added Global parameter ($iAu3SH_AbortHighlight) to abort the highlighting process (break the function execution).
   - If this variable set to 1, the function will return the original Au3 Code and set @error to -1.
+ Added "#White space" style support (now you can set it in the au3.styles.properties file).
+ Added "#Background" style support, used only for highlighting with Html tags mode (now you can set it in the au3.styles.properties file).
* Styles header classes renamed with "au3_" prefix.
* Fixed bug with highlighting COM objects.
* Fixed bug with highlighting keywords inside variables.
* Fixed bug with highlighting more than one preprocessor when instead of <Include.au3> used double/single qoutes ("Include.au3").
* Fixed bug with highlighting commented lines/comment blocks inside literal strings.
* Fixed bug with not (properly) highlighting commented lines.
* Fixed issue with converting to BBCode format.
* Now the PreProcessor and Special keywords are correctly highlighted (all included tags removed).

[0.1]
* First public release.



Attachments:

AutoItSyntaxHighlight_1.2.zip

AutoItSyntaxHighlight_1.1.zip
AutoItSyntaxHighlight_1.0.zip
AutoItSyntaxHighlight_0.9.zip
AutoItSyntaxHighlight_0.8.zip
AutoItSyntaxHighlight_0.7.zip
AutoItSyntaxHighlight_0.6.zip
AutoItSyntaxHighlight_0.5.zip
AutoItSyntaxHighlight_0.4.zip
AutoItSyntaxHighlight_0.3.zip
AutoItSyntaxHighlight_0.2.zip
AutoItSyntaxHighlight_0.2.zip
AutoItSyntaxHighlight.zip

post-20477-0-30772400-1428952793_thumb.p

AutoItSyntaxHighlight_1.1.zip AutoItSyntaxHighlight_1.2.zip

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 3 months later...

New version...

[0.2]

+ Added Global parameter ($iAu3SH_AbortHighlight) to abort the highlighting process (break the function execution).

If this variable set to 1, the function will return the original Au3 Code and set @error to -1.

+ Added "#White space" style support (now you can set it in the au3.styles.properties file).

+ Added "#Background" style support, used only for highlighting with Html tags mode (now you can set it in the au3.styles.properties file).

* Styles header classes renamed with "au3_" prefix.

* Fixed bug with highlighting COM objects.

* Fixed bug with highlighting keywords inside variables.

* Fixed bug with highlighting more than one preprocessor when instead of <Include.au3> used double/single qoutes ("Include.au3").

* Fixed bug with highlighting commented lines/comment blocks inside literal strings.

* Fixed bug with not (properly) highlighting commented lines.

* Fixed issue with converting to BBCode format.

* Now the PreProcessor and Special keywords are correctly highlighted (all included tags removed).

Please check the first post. Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

And one more update:

v0.3

* Fixed bug when strings and send keys was highlighted inside commented lines.

* Few optimizations to the code.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 9 months later...

Update:

[0.4]

* Fixed bug with (re)highlighting keywords and functions inside COM object methods.

* Docs updated.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 2 months later...

You know what would make this more interesting? Would be to set it so that you load it into a rich editbox and it does all of the highlighting in there (without writing to the file), instead of being saved as an html file. What do you think? or do you think that it would be too slow?

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...
  • 11 months later...

Update.

[0.5]

* Fixed bug with highlighting literal strings inside comment blocks.

* Fixed few issues with highlighting special keywords.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Hi Mate I love this work.

I got a Wrong output with this code.

Normal

#cs -------------------------------------------------------
AutoIt Version: 3.3.8.1
Author..........: dany
Script Function...: Dir "Retorna la Ruta sin el nombre del Archivo
Uso..............: Dir("C:\Windows\System32\Dismes-ESMsiProvider.dll.mui") Retorna "C:\Windows\System32\Dismes-ES"
#ce -------------------------------------------------------

;Ejemplo
$ruta="C:\Windows\System32\Dismes-ESMsiProvider.dll.mui"
msgbox(0,"C:\Windows\System32\Dismes-ES",Dir($ruta))

;Funcion Dir
func Dir($path)
local $delimiter=""
$array =StringSplit($path,$delimiter)
$len=UBound($array)-1
$numero= $len-1
$num=StringInStr($path,$delimiter,0,$numero)
$dir=StringMid($path,1,$num)
return $dir
EndFunc

With your software change my variable $delimiter

#cs -------------------------------------------------------

AutoIt Version: 3.3.8.1

Author..........: dany

Script Function...: Dir "Retorna la Ruta sin el nombre del Archivo

Uso..............: Dir("C:\Windows\System32\Dismes-ESMsiProvider.dll.mui") Retorna "C:\Windows\System32\Dismes-ES"

#ce -------------------------------------------------------

;Ejemplo

$ruta="C:\Windows\System32\Dismes-ESMsiProvider.dll.mui"

msgbox(0,"C:\Windows\System32\Dismes-ES",Dir($ruta))

;Funcion Dir

func Dir($path)

local $delimiter="C:\Windows\System32\Dismes-ESMsiProvider.dll.mui"

$array =StringSplit($path,$delimiter)

$len=UBound($array)-1

$numero= $len-1

$num=StringInStr($path,$delimiter,0,$numero)

$dir=StringMid($path,1,$num)

return $dir

EndFunc

Edited by Danyfirex
Link to comment
Share on other sites

I got a Wrong output with this code.

Fixed, please check the first post :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Fixed, please check the first post :)

Simply Amazing MrCreatoR thank you so much

Link to comment
Share on other sites

Simply Amazing MrCreatoR thank you so much

And thank you for revealing this bug, it is strange that this haven't been noticed before by others.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

hi mate it's me again reporting another bug when I use in this code.

I use so much you usefull tool :thumbsup:

where my registry keys are, I put some comment line with the problem.

maybe for next version you can add size-type font. it's only a suggestion.

Thank you Again for you great tool MrCreatoR

#cs -------------------------------------------------------
AutoIt Version: 3.3.8.1
Author..........: Danyfirex
Script Function...: ListarRun
Uso..............: $Listar=listarRun()
Retorna : Lista las Claves Run en un Array

#ce -------------------------------------------------------


;Ejemplo

#include

$Listar=listarRun()

_ArrayDisplay($Listar,"Funcion Listar Runs")


Func listarRun()
local $valor


Select
Case @OSArch="X64"

Local $clave[3]
local $Array
Local $split
local $XD =1
$clave[0]="HKLM64SoftwareMicrosoftWindowsCurrentVersion Run";here Make me one space in my string "Run"
$clave[1]="HKLMSoftwareMicrosoftWindowsCurrentVersionRu n";here Make me one space in my string"Run"
$clave[2]="HKCUSoftwareMicrosoftWindowsCurrentVersionRu n";here Make me one space in my string "Run"

for $a=0 to 2
For $i = 1 To $XD

Local $var = RegEnumVal($clave[$a], $i)
if _RegExist($clave[$a],$var) Then
$valor=RegRead($clave[$a],$var)
$clavereg=StringSplit($clave[$a],"")



$Array&=($clavereg[1] & " - Run: " &"[" & $var& "] - " & $valor)&@CR
$XD+=1
EndIf

Next

next

$split=stringsplit($Array,@CRLF)
ReDim $split[UBound($split)-1]
return $split



Case @OSArch="X86"
local $clave2[2]
local $Array
local $split
local $XD =1
$clave2[0]="HKLMSoftwareMicrosoftWindowsCurrentVersionRu n" ;here Make me one space in my string "Run"
$clave2[1]="HKCUSoftwareMicrosoftWindowsCurrentVersionRu n" ;here Make me one space in my string "Run"

for $a=0 to 1
For $i = 1 To $XD

Local $var = RegEnumVal($clave2[$a], $i)
if _RegExist($clave2[$a],$var) Then
$valor=RegRead($clave2[$a],$var)
$clavereg=StringSplit($clave2[$a],"")
$Array&=($clavereg[1] & " - Run: " &"[" & $var& "] - " & $valor)&@CR
$XD+=1
EndIf

Next

next

$split=stringsplit($Array,@CRLF)
ReDim $split[UBound($split)-1]
return $split

EndSelect

EndFunc


Func _RegExist($sKeyName, $sValueName)
RegRead($sKeyName, $sValueName)
Return @error = 0
EndFunc
Edited by Danyfirex
Link to comment
Share on other sites

I am not sure that i understand the bug...

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...