AutoHotkey Community

It is currently May 25th, 2012, 6:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: copy&paste vs. script
PostPosted: February 14th, 2005, 6:52 pm 
Hi

Well - both things do quite the same. When you copy&paste the text to your wordfile.txt you have to be careful that you do not have already another language hilightet with the language description /L10 - in this case you have to change /L10 to a free hilighting syntax description - you can use L1 to L20.
Another bad thing is that you have to use an actual wordfile text to get all commands highlighted right - if you use the script, the script checks for a free L-Part in your existing wordfile and writes the actual values of the delivered syntax-file from editplus (autohotkey.stx in your AutoHotKey installation - subdir \extras\editors\editplus)
i havent analyzed the complete script, but what i have seen the script checks for containing values and actualizes the existing wordfile with new values found in thd .stx file.

hope everything is clear now and sorry for my bad (-german-) english

daniel


Report this post
Top
  
Reply with quote  
PostPosted: February 14th, 2005, 8:09 pm 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
danielboukreev wrote:
the script checks for a free L-Part in your existing wordfile and writes the actual values of the delivered syntax-file from editplus (autohotkey.stx in your AutoHotKey installation - subdir \extras\editors\editplus)
i havent analyzed the complete script, but what i have seen the script checks for containing values and actualizes the existing wordfile with new values found in thd .stx file.


I'm not sure if I understood the essence.

Does syntax file of editplus serve as a reference?
If not, I do not understand the practical advantages of the script in comparison to the copy&paste method (when we regard the choice of the correct L-number as easy).

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: syntaxfile of editplus
PostPosted: February 14th, 2005, 8:53 pm 
hi

thats it - autohotkey.stx is used as reference file - so if you get a new version of AutoHotKey and the author of the program delivers a new version of the file autohotkey.stk within, the wordfile of Ultraedit can be updated with the script. Thats why I'm using the script to keep my wordfile up to date.


Report this post
Top
  
Reply with quote  
PostPosted: February 14th, 2005, 9:33 pm 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
danielboukreev wrote:
thats it - autohotkey.stx is used as reference file - so if you get a new version of AutoHotKey and the author of the program delivers a new version of the file autohotkey.stk within, the wordfile of Ultraedit can be updated with the script.

Sounds very elegant.

Because I never used a script to update a wordfile for uedit:
Could you or anyone else please explain all necessary steps (for the posted scriptcode)?
Thanks.

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: things to do...
PostPosted: February 14th, 2005, 11:02 pm 
well, it's quite easy to handle - just copy the code to an empty file, rename it with the extention ".ahk" and start the script - after that .ahk and .ini files should be highlighted correctly. Make sure to relaunch Ultraedit for a correct load of the new written wordfile.txt

There are several checks in the script - it might be you're asked for the location of some files (e.g. uedit32.ini or AutoHotKey.stx...) - if this happens, search the files with Windows-File-Explorer and browse with the script-dialog to the place you found the files.

regards


Report this post
Top
  
Reply with quote  
 Post subject: Re: things to do...
PostPosted: February 15th, 2005, 12:10 am 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
danielboukreev wrote:
well, it's quite easy to handle - just copy the code to an empty file, rename it with the extention ".ahk" and start the script

It worked fine. Thank you.

But the different parts of hotstrings are not highlighted:
Delimiter, trigger, result, switch, escaped-characters, "{Left}", "`r" etc.

Something is highlighted which should not: digits in results They should be treated like letters.

May be someone likes to improve the higlighting of hotstrings?

The most important reason for a good highlighting is to get better readable hotstring code which distinguishes clearly between triggers, results and the rest.

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Last edited by Andreas Borutta on February 15th, 2005, 9:13 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 8:15 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Could you please post some of the code that isn't highlighted correctly?
Maybe we can extpand the Function String or add a new one (UE supports up to 5 Function Strings)

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 9:36 am 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
toralf wrote:
Could you please post some of the code that isn't highlighted correctly?
Maybe we can extpand the Function String or add a new one (UE supports up to 5 Function Strings)


Code:
:o:tt1::
   ~~~
WinGet, ProcessName, ProcessName, A
If ProcessName = uedit32.exe
   Send one+{Enter}two ´;and`r3{{}{}}{Left}
        ^^^        ^^^  ^^^^  ^ ^  ^
else
   Send test
        ^^^^
Return

:o:tt2::one+{Enter}two ´;and`r3{{}{}}{Left}
   ~~~  ^^^        ^^^  ^^^^  ^ ^  ^

trigger:
tt1
or
tt2

result:
one
two ;and
3{}


I used "~" for triggers and "^" to underline results, which both are the most important parts of hotstrings.
May be an autor likes to give the triggers and result a different color.

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 12:37 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
I'm not familiar with the Send Command. So I do not know what you are trying to send.

I found out the following:
Functions are not highlighted as far as I know. But to capture triggers with options also as functions use this in the wordfile instead of the existing line:
Code:
/Function String = "%[^t ]++^(:++[a-zA-Z0-9]++:++[a-zA-Z0-9_äöüß<>^~!$#+.*^^^[^]]++:+^)"
This should work better and capture all of the following as functions
    :K100:tt1::
    :o:tt1::
    ::tt1::
    tt1:
Open the view "function list" to see them listed. Please everyone, let me know if this is having a drawback, I couldn't find one yet.

Quote:
Send one+{Enter}two ´;and`r3{{}{}}{Left}

I do not know if this is what you want to send, because of the "´;": since the ´ is not the escape character `. The ; will be the start of a comment. Since comments override all other color coding the later will be green.
But to show everything that is behind `; not as a comment the ` and ; have to be removed from the delimiters, so that the line in the wordfile looks like this
Code:
/Delimiters = ~!@%^&*()-+=|\/{}[]:´"'<> , .?


To capture `n and `r you can add them to any /C section as a extra line. But to be highlighted correctly they have to have a leading delimiter.

To the rest of your wishes I haven't found a solution yet. And I doubt that this will be possible. Since everything that comes behind SEND can be everything, how should UE know to highlight it. And there doesn't exist a option to highlight a line when a keyword shows up (except comments). So the only way is that you use send as a comment (or blcok comment) But this would jeopardize the comment highlightning.

But if you like it very colorfull add the follwoing lines to a /C section
Code:
`n `r
** x y w h r v g
Off On
cBlue cDefault cGreen cRed cWhite
bold
norm
=
<
>
:
|
All
+
-
,
{
}

The ** stuff is tricky, though. This is nice when you work with GUIs, since these are options for controls. But now all text that starts with these characters will be highlighted.

Once I have found a highlight that fits my needs I will post it (and hopefully the code to produce the wordfile will coming with it).

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 1:43 pm 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
Quote:
I do not know if this is what you want to send, because of the "´;": since the ´ is not the escape character `.

Sorry, that was my typing error.
I meant "`".

Quote:
Once I have found a highlight that fits my needs I will post it (and hopefully the code to produce the wordfile will coming with it).

Fine. Please let me know this.

I couldn't comment your thoughts for the highlighting script because I don't know this stuff.

Did you understood my issues for the syntaxhighlighting of hotstrings?

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 4:48 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Andreas Borutta wrote:
May be an autor likes to give the triggers and result a different color.


I think I understand your wish. You want the "tt1", "one", "two", ";and" and "3{}" to be highlighted. But that doesn't work with UE, I guess, since all of these strings are no keywords. They are abituary text or numbers.

But you could specify all keywords known to AHK for highlightning. And the rest is normal text for UE. But you can specify for the normal text a "special" color, if that serves you.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 6:56 pm 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
Quote:
I think I understand your wish. You want the "tt1", "one", "two", ";and" and "3{}" to be highlighted.

Exactly.
Quote:
But that doesn't work with UE, I guess, since all of these strings are no keywords. They are abituary text or numbers.

But you could specify all keywords known to AHK for highlightning. And the rest is normal text for UE. But you can specify for the normal text a "special" color, if that serves you.

Hups.
And I thought the highlighting allows some smart methods, not only dump keyword lists.
I thought, that, whatever could be matched by regular expressions could be used for highlighting.

Well in fact, I don't know what is possible in highligthing and what is not.
I only know that it would be very useful to have a smart hightlighting for hotstrings.

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2005, 7:26 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
AFAIK UE only uses regular expressions to detect functions. The rest is a list of keyword or substrings (** substring)

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 1:38 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Ok, here is a mod of Tekls script.
- It adss or updates AHK syntax highlight for UltraEdit
- It uses the systax files directly, which are coming with AHK.
- It doesn't write or read to/from Registry
- You can extend the highlight with extra syntax files (containing keywords or substrings)

@Chris: You can add this to AHK distribution, if you want

@All: Please report bugs or improvements, thanks.

Code:
;##############################################################################
;#
;#  Add or update syntaxhiglighting for AutoHotKey scripts in UltraEdit
;#
;#  Mod of a script done by Tekl (although not much has survived)
;#  Mod done by toralf, 2005-02-15
;#
;#  Tested with: AHK 1.0.26.00, Windows XP Pro, UltraEdit 10.10c/10.20
;#
;#  Requirements
;#    - Syntax files for AHK in one directory
;#    - UltraEdit uses standard file for highlighting => wordfile.txt
;#
;#  Customize:
;#    - The default color for strings is gray, change it to any color
;#         you want to have "%var%" to appeer => Extra->Option->syntaxhiglighting
;#    - Change the default color for up to 8 keyword groups
;#         => Extra->Option->syntaxhiglighting
;#    -specify up to 8 syntax files, each containing one keywords per line
;#         => you can add your own files, for keywords that you want to highlight
;#            Personally I use 3 additional: Operators, Separators and Special
;#            Operators.txt => "=`n<`n>`n*`n/`n+`n-"
;#            Separators.txt => "``n`n``r`n|`n,`n{`n}"
;#            Special.txt => "** x y w h r v g`nis`nnot`nCBlue`ncRed"
;#

; Specify a list of up to 8 syntax files; the order influences the color given to them by UE by default
SyntaxFileNameList = CommandNames|Keywords|Variables|Keys      ; e.g. add |Operators|Separators|Special
;Default colors in UE:  blue     |red     |orange   |green    |brown   |blue      |blue    |blue

SyntaxExtention = .txt

; Edit this to help this script to find AHK and UltraEdit
PathProgramFiles = %ProgramFiles%

PathSyntaxFiles = %PathProgramFiles%\AutoHotkey\Extras\Editors\Syntax
FileUEWordFile = %PathProgramFiles%\UltraEdit\wordfile.txt

;#############   END of Custamization Area   ##################################

;#############   Ask and Check for valid input  ###############################

;Search or ask for Wordfile, when it doesn't exist -> exit
IfNotExist, %FileUEWordFile%
   FileSelectFile, FileUEWordFile, 1, %PathProgramFiles%, Select UltraEdit wordfile, *.txt
ifNotExist, %FileUEWordFile%
  {
   MsgBox, 16,, UltraEdit Wordfile cannot be found.
   ExitApp
  }

;Search or ask for specified syntax folder and files, when they don't exist -> exit
IfNotExist, %PathSyntaxFiles%
   FileSelectFolder, PathSyntaxFiles, %PathProgramFiles%,2, Select Folder of Syntax Files
MissingFile =
FileCount = 0
Loop, Parse, SyntaxFileNameList, |
  {
    FileCount += 1
    ifNotExist, %PathSyntaxFiles%\%A_LoopField%%SyntaxExtention%
         MissingFile = %MissingFile%`n%A_LoopField%%SyntaxExtention%
  }
If MissingFile is not space
  {
   MsgBox, 16,, AHK Syntax file(s)`n%MissingFile%`n`ncannot be found in`n`n%PathSyntaxFiles%\.
   ExitApp
  }
If FileCount > 8
  {
   MsgBox, 16,, You have specified %FileCount% Syntax files.`nOnly 8 are supported be UltraEdit.`nPlease shorten the list.
   ExitApp
  }

;Check the number of languages in the current wordfile, if more than 19 without AHK -> exit
NumberOfLanguages = 0
Loop, Read, %FileUEWordFile%
  {
    StringLeft, WFdef, A_LoopReadLine, 2
    if WFdef = /L
        StringSplit, WFname, A_LoopReadLine, "
        LanguageName = %WFname2%
        if LanguageName <> AutoHotkey
            NumberOfLanguages +=1
  }
If NumberOfLanguages > 19
  {
    MsgBox, 48,, The wordfile has %NumberOfLanguages% syntax-schemes. UltraEdit does only support 20 schemes.`nPlease delete one scheme from the file!
    ExitApp
  }

;#############   Read keywords from syntax files into arrays   ################

Loop, Parse, SyntaxFileNameList, |  ;Read all syntax files
  {
    SyntaxFileName = %A_LoopField%
    GoSub, ReadSyntaxFromFile       ;SyntaxFileName will become string with keywords
  }

;#############   Build language specific highlight for AHK   ##################

StrgAHKwf = "AutoHotkey" Nocase
StrgAHKwf = %StrgAHKwf% Line Comment = `;
StrgAHKwf = %StrgAHKwf% Line Comment Preceding Chars = [~``]     ;to escape escaped ;
StrgAHKwf = %StrgAHKwf% Escape Char = ``
StrgAHKwf = %StrgAHKwf% String Chars = `%
StrgAHKwf = %StrgAHKwf% Block Comment On = /*
StrgAHKwf = %StrgAHKwf% Block Comment Off = */
StrgAHKwf = %StrgAHKwf% File Extensions = ini ahk`n
StrgAHKwf = %StrgAHKwf%/Delimiters = ~!@`%^&*()-+=|\/{}[];``:"'<%A_TAB%> ,.?`n
StrgAHKwf = %StrgAHKwf%/Indent Strings = "{" ":"`n
StrgAHKwf = %StrgAHKwf%/Unindent Strings = "}" "Return" "Else"`n
StrgAHKwf = %StrgAHKwf%/Function String = "`%[^t ]++^(:++[a-zA-Z0-9]++:++[a-zA-Z0-9_äöüß<>^~!$#+.*^^^[^]]++:+^)"`n

Loop, Parse, SyntaxFileNameList, |      ;Add the keywords from syntax strings into their sections
  {
    StrgAHKwf = %StrgAHKwf%/C%A_Index%"%A_LoopField%"   ;section definition
    SyntaxString = %A_LoopField%             ;which section/syntax
    GoSub, ParseSyntaxString                 ;parse through string and add to list
  }

;#############   Add or Update Wordfile   #####################################

;Name of a file for temporary store the word file
TemporaryUEwordFile = TempUEwordFile.txt
FileDelete, %TemporaryUEwordFile%

Loop, Read, %FileUEWordFile%, %TemporaryUEwordFile%   ;Read through Wordfile
  {
    StringLeft, WFdef, A_LoopReadLine, 2
    if WFdef = /L
      {
        StringSplit, WFname, A_LoopReadLine, "
        LanguageName = %WFname2%
        LanguageNumber = %WFname1%
        StringTrimLeft,LanguageNumber,LanguageNumber,2
        if LanguageName = AutoHotkey         ;when AHK section found, place new section at same location
          {
            FileAppend, /L%LanguageNumber%%StrgAHKwf%
            AHKLanguageFound := True
          }
      }
   
    if LanguageName <> AutoHotkey            ;everything that does not belong to AHK, gets unchanged to file
        FileAppend, %A_LoopReadLine%`n
  }
 
if not AHKLanguageFound                      ;when AHK section not found, append AHK section
  {
    LanguageNumber += 1
    FileAppend, /L%LanguageNumber%%StrgAHKwf%, %TemporaryUEwordFile%
  }

FileCopy, %FileUEWordFile%, %FileUEWordFile%.ahk.bak, 1    ;Create Backup of current wordfile
FileMove, %TemporaryUEwordFile%, %FileUEWordFile%, 1       ;Replace wordfile with temporary file

; Tell user what has been done
if AHKLanguageFound
   MsgBox, 64,, The AutoHotkey-Syntax for UltraEdit has been updated in your wordfile:`n`n%FileUEWordFile%`n`nA backup has been created in the same folder.
else   
   MsgBox, 64,, The AutoHotkey-Syntax for UltraEdit has been added to your wordfile:`n`n%FileUEWordFile%`n`nA backup has been created in the same folder.

ExitApp  ; That's it, exit

;#############   SubRoutines   ################################################

ReadSyntaxFromFile:
TempString =
Loop, Read , %PathSyntaxFiles%\%SyntaxFileName%%SyntaxExtention%   ;read syntax file
  {
    StringLeft,Char, A_LoopReadLine ,1
    If Char <> `;                                        ;if line is comment, don't bother
           TempString = %TempString%%A_LoopReadLine%`n   ;otherwise add keyword to string
  }
%SyntaxFileName% = %TempString%                          ;Assign string to syntax filename
Sort, %SyntaxFileName%, U                                ;Sort keywords in string
return

ParseSyntaxString:
Loop, Parse, %SyntaxString%, `n                 ;parse through syntax string
  {
    StringLeft, Char, A_LoopField,1
    If (Char = PrevChar)                       ;add keyword to line when first character is same with previous keyword
       StrgAHKwf = %StrgAHKwf% %A_LoopField%
    else                                       ;for every keyword with a new first letter, start a new row
       StrgAHKwf = %StrgAHKwf%`n%A_LoopField%
    PrevChar = %Char%                          ;remember first character of keyword
  }
return
;#############   END of File   ################################################

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2005, 7:39 pm 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
Quote:
@All: Please report bugs or improvements, thanks.

Message:
"The wordfile has 928 shemes. Uedit has only 20. Please delete one sheme"

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: fragman, Relayer and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group