AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display and Sort Hotkeys
Goto page Previous  1, 2, 3, 4, 5, 6
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Thu Jul 29, 2010 1:07 pm    Post subject: Reply with quote

That is strange, you should post a snippet of your script, and i'll try it out.
Is it a permissions issue? maybe the script cannot read the file you are giving it? are you running from an exe? (it can't parse exe files).
Back to top
View user's profile Send private message
rosto



Joined: 14 Feb 2006
Posts: 40

PostPosted: Thu Jul 29, 2010 1:12 pm    Post subject: Reply with quote

vixay wrote:
That is strange, you should post a snippet of your script, and i'll try it out.
Is it a permissions issue? maybe the script cannot read the file you are giving it? are you running from an exe? (it can't parse exe files).


No, I don't run it from an exe.

How can I call the script to see it?

(I put the include in the autoload section now)
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Thu Jul 29, 2010 1:16 pm    Post subject: Reply with quote

rosto wrote:
vixay wrote:
That is strange, you should post a snippet of your script, and i'll try it out.
Is it a permissions issue? maybe the script cannot read the file you are giving it? are you running from an exe? (it can't parse exe files).


No, I don't run it from an exe.

How can I call the script to see it?

(I put the include in the autoload section now)


I am not sure I understand what you are saying. I was asking you to paste a copy of your script here, so that I can try to run it and see what the problem is. If you are uncomfortable doing that, then it's hard to figure out what could be wrong.
Are you using the latest version of AHK?
Back to top
View user's profile Send private message
rosto



Joined: 14 Feb 2006
Posts: 40

PostPosted: Thu Jul 29, 2010 1:55 pm    Post subject: Reply with quote

Ah sorry,

My script I try to run is

Code:

; http://www.autohotkey.com/forum/topic215.html
;*******************************************************************************
; Extract a list of Hotstrings and Hotkeys from this script and display them
;*******************************************************************************
; Modified by Vixay Xavier on Sat October   11, 2008 06:02:29 PM
; Modified by infogulch    on Mon September 21, 2009 08:30:00 PM
; Modified by infogulch    on Tue September 22, 2009 03:00:00 PM
; Modified by Bousch on 2010-02-09 18:13
;          changed view to listview
;          added sorting with ctrl-1 (name) and Ctrl-2 (text)
;          activate hotkey with enter or dblclick

;#SingleInstance force

keylist=

ShowListView:
   Gui, Destroy
   Gui, Add, ListView, xm r40 w450 Grid vMyListView gMyListView AltSubmit, Name|Text|key
   Gui, Add, Button, Hidden Default, OK

   split_chars := "¬"
   loop, parse, keylist, `n, `r
   {
      ; initialize vars because stringsplit doesn't
      key_array1 =
      key_array2 =
      key_array3 =
      StringSplit, key_array, A_LoopField, %split_chars%
      ; rows below remove spaces before and after
      Name = %key_array1%
      Desc = %key_array2%
      Hk = %key_array3%
      If (Name != "")
         LV_Add("", Name, Desc, Hk)
   }
   LV_ModifyCol()  ; Auto-size each column to fit its contents.
   LV_ModifyCol(1, "Sort")
   Gui, +Resize
   Gui, Show,,AHK-Help   
return

MyListView:
   if A_GuiEvent = DoubleClick
   {
      LV_GetText(hk_label, A_EventInfo, 3)
      RunHK(hk_label)
   }

   ; Sort with ^1 and ^2
   if A_GuiEvent = K
   {
      ControlState := GetKeyState("Ctrl")
      if (ControlState = 1)
      {
         if (A_EventInfo = 49)
         {
            ; 1 pressed
            if sorted = 1
            {
               LV_ModifyCol(1, "SortDesc")
               sorted := 0
            } else {
               LV_ModifyCol(1, "Sort")
               sorted := 1
            }
         } else {
            if (A_EventInfo = 50)
            {
               if sorted = 2
               {
                  LV_ModifyCol(2, "SortDesc")
                  sorted := 0
               } else {
                  LV_ModifyCol(2, "Sort")
                  sorted := 2
               }
            }
         }
      }
   }
return

GuiSize:  ; Expand or shrink the ListView in response to the user's resizing of the window.
   if A_EventInfo = 1  ; The window has been minimized.  No action needed.
      return
   ; Otherwise, the window has been resized or maximized. Resize the ListView to match.
   GuiControl, Move, MyListView, % "W" . (A_GuiWidth - 20) . " H" . (A_GuiHeight - 20) ;%
return

ButtonOK:
   GuiControlGet, FocusedControl, FocusV
   if FocusedControl <> MyListView
      return
   LV_GetText(hk_label, LV_GetNext(0, "Focused"), 3)
   RunHK(hk_label)
   Return

GuiEscape:
   Gui, Cancel
Return

RunHK(label) {
   if IsLabel(label)
   {
      Gui, Cancel
      Gosub, %label%
   }
   else
   {
      MsgBox %label%
   }
}
;===============================================================
ViewKeyListFromHK( scriptfile ) {
   global keylist
   keylist := FormatKeyListFile(scriptfile)
   Gosub ShowListView
}

FormatKeyListFile( scriptfile, force = False ) {
; this function reads scriptfile and returns a formatted string from FormatKeyList
; it automatically caches the most recent formatted result so it doesn't have to reparse it
; pass force = True to force it to reread and reparse the scriptfile
   static file, formatted
   if (file != scriptfile) && !Force
   {
      fileread, contents, %scriptfile%
      formatted := FormatKeyList( contents )
      file := scriptfile
   }
   return formatted
}

FormatKeyList( lines, srt = False ) {
; this does the actual formatting. Pass the text to be formatted
   loop, parse, lines, `n, `r
      if SubStr(A_LoopField, 1, 2) = ";;"
         KeyList .= SubStr(A_LoopField, 3) "`n"
      else if RegExMatch(A_LoopField, "^\s*(?<hk>[^:]+)::(?<cmd>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
         KeyList .= HumanReadableHK( _hk ) "¬" (_desc ? _desc : _cmd) "¬" _hk "`n"
      else if RegExMatch(A_LoopField, "^\s*:(?<opt>[^:]*):(?<hs>[^:]+)::(?<rep>.*?)(?:(?<=\s);;(?<desc>.*))?$", _)
         KeyList .= _hs "¬" (_desc ? _desc : _rep) "¬" ":" _opt ":" _hs "`n"
   if sort
      sort, KeyList, P16 ; sort the comments
   return KeyList
}

HumanReadableHK( key ) {
;a function to take care of replacing symbols in hotkeys with their words
  StringReplace, key, key, +, Shift%A_Space%+%A_Space%
  StringReplace, key, key, #, Win%A_Space%+%A_Space%
  StringReplace, key, key, !, Alt%A_Space%+%A_Space%
  StringReplace, key, key, ^, Ctrl%A_Space%+%A_Space%
  StringReplace, key, key, &, %A_Space%and%A_Space%
  StringReplace, key, key, $, hooked%A_Space%
  return key
}
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Sat Jul 31, 2010 6:18 am    Post subject: No Reply with quote

No i think you misunderstood what I was trying to say. Please post the script you wrote or are using from which you want to see the hotkey list. The script you posted is just the same as the previous ones. Because the error is related to the script where you have included this script, not keylist. Please delete your previous post (to remove unnecessary duplicate code) and post only your script.
Back to top
View user's profile Send private message
rosto



Joined: 14 Feb 2006
Posts: 40

PostPosted: Tue Aug 03, 2010 1:56 pm    Post subject: Reply with quote

Hi Vixay,

Hereby I send you the whole .ahk file I use to include the keylist script.

Code:

Menu,Tray,Add,View Hotkeys, KeyList ; is a label not a function
return

Keylist:
ViewKeyList(A_ScriptFullPath)
return




;-------------- ctrl-shift-2 --> Remove Line Feeds --------------
^+2:: ;;Remove LF
Send ^x
VerwijderLF = %clipboard%
StringReplace, VerwijderLF, VerwijderLF, `r`n, %A_SPACE%, All
clipboard = %VerwijderLF%
Send ^v
return


;-------------- ctrl-shift-3 --> remove empty lines --------------
^+3:: ;;Remove Empty Lines
Send ^x
VerwijderEL = %clipboard%
Loop
{
    StringReplace, VerwijderEL, VerwijderEL, `r`n`r`n, `r`n, UseErrorLevel
    if ErrorLevel = 0  ; No more replacements needed.
        break
}
clipboard = %VerwijderEL%
Send ^v
return


;-------------- ctrl-q --> search in browser current tab --------------
^q:: ;;Search in current tab
   Send ^c
   CopieTxt = %Clipboard%
   SetTitleMatchMode 2
     if !WinExist("Mozilla Firefox") AND !WinExist("Google Chrome") AND !WinExist("ahk_class IEFrame")
     {
     Run, C:\Program Files\Mozilla Firefox\firefox.exe
     WinWaitActive, Mozilla Firefox
    Sleep 1000
    }
     else if !WinActive("Mozilla Firefox") AND !WinActive("Google Chrome") AND !WinActive("ahk_class IEFrame") AND WinExist("Mozilla Firefox")
         {
         WinActivate, Mozilla Firefox
        }
            else if WinActive("Mozilla Firefox")
         {
         WinActivate, Mozilla Firefox
         }
            else if WinExist("Google Chrome") AND !WinActive("ahk_class IEFrame")
            {
            WinActivate, Google Chrome
            }
               else
               {
               WinActivate, ahk_class IEFrame
               }
   MijnTab = http://www.google.com/search?q=%Clipboard%
   clipboard = %MijnTab%
   Sleep 400
   Send {F6}
   Send ^v
   Send {Enter}
   Clipboard = %CopieTxt%
return


;-------------- ctrl-shift-q --> search in browser new foreground tab --------------
^+q:: ;;Search in new foreground tab
   Send ^c
   CopieTxt2 = %Clipboard%
   SetTitleMatchMode 2
     if !WinExist("Mozilla Firefox") AND !WinExist("Google Chrome") AND !WinExist("ahk_class IEFrame")
     {
     Run, C:\Program Files\Mozilla Firefox\firefox.exe
     WinWaitActive, Mozilla Firefox
    Sleep 1000
    }
     else if !WinActive("Mozilla Firefox") AND !WinActive("Google Chrome") AND !WinActive("ahk_class IEFrame") AND WinExist("Mozilla Firefox")
         {
         WinActivate, Mozilla Firefox
        }
            else if WinActive("Mozilla Firefox")
         {
         WinActivate, Mozilla Firefox
         }
            else if WinExist("Google Chrome") AND !WinActive("ahk_class IEFrame")
            {
            WinActivate, Google Chrome
            }
               else
               {
               WinActivate, ahk_class IEFrame
               }
   NieuwTab = http://www.google.com/search?q=%Clipboard%
   clipboard = %NieuwTab%
   Sleep 200
   Send ^t
   Sleep 600
   Send ^l
   Sleep 200
   Send ^v
   Send {Enter}
   Clipboard = %CopieTxt2%
return


;-------------- win-y --> yahoo search -------------- 
#y:: ;;Yahoo search
   Send ^c
   CopieTxtYHOO = %Clipboard%
   YHOOTab = http://search.yahoo.com/search?p=%Clipboard%
   clipboard = %YHOOTab%
   Sleep 400
   Send {F6}
   Send ^v
   Send {Enter}
   Clipboard = %CopieTxtYHOO%
return


;-------------- win-m --> google map search --------------
#m:: ;;Google Map search
   Send ^c
   CopieTxtMAP = %Clipboard%
   GoogleMAP = http://maps.google.com/maps?q=%Clipboard%
   clipboard = %GoogleMAP%
   Sleep 400
   Send {F6}
   Send ^v
   Send {Enter}
   Clipboard = %CopieTxtMAP%
return


;-------------- win-b --> amazon book search --------------
#b:: ;;Amazon search
   Send ^c
   CopieTxtBOOK = %Clipboard%
   Amazon = http://www.amazon.com/s/ref=nb_ss?url=search-alias`%3Dstripbooks&field-keywords=%ClipBoard%&x=0&y=0
   ;Amazon = http://www.domain.com/s/url=search`%2&keyword=test
   clipboard = %Amazon%
   Sleep 400
   Send {F6}
   Send ^v
   Send {Enter}
   Clipboard = %CopieTxtBOOK%
return


;;
;-------------- firefox ctrol/shift-scroll up-down --> END/HOME --------------
SetTitleMatchMode 2
#ifWinactive Firefox
^+WheelUp::Send {HOME}   ;;FF: Begin of Page
^+WheelDown::Send {END}  ;;FF: End of Page
return


#Include, D:\\KeyList2.ahk


KeyList2.ahk is the code in previous message

Thank you Smile
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Wed Aug 04, 2010 4:43 am    Post subject: works for me Reply with quote



It works for me.
the only change i had to make was remove D:\\ from your include parameter. This is the output i get

Code:
Ctrl + Shift + 2 == Remove LF
Ctrl + Shift + 3 == Remove Empty Lines
Ctrl + q == Search in current tab
Ctrl + Shift + q == Search in new foreground tab
Win + y == Yahoo search
Win + m == Google Map search
Win + b == Amazon search

Ctrl + Shift + WheelUp == FF: Begin of Page
Ctrl + Shift + WheelDown == FF: End of Page

what version of autohotkey are you using?
Back to top
View user's profile Send private message
AutoWolfCub



Joined: 02 Sep 2008
Posts: 14
Location: Berkshire, England

PostPosted: Fri Jan 14, 2011 5:43 pm    Post subject: Re: works for me Reply with quote

vixay wrote:
It works for me.
the only change i had to make was remove D:\\ from your include parameter.


Sorry, keylist2 doesn't work for me (though the scripts may be out of date due to newer versions of the language). I get a "This line does not contain a recognized action" error message in
Code:
FormatKeyList


Code:
KeyList .= SubStr(A_LoopField, 3) "`n"
in line 139

It looks like a simple subroutine but the .= and the "`n" parts seem out of place?

Similar problems for line 141:

Code:
KeyList .= HumanReadableHK( _hk ) "¬" (_desc ? _desc : _cmd) "¬" _hk "`n"


With these edited out I then get a "Call to non-existent function" error for the SubStr call on line 138; also for RegExMatch nearby.

I'm running AHK 1.0.44.07 on Win XP
_________________
A prudent question is one-half of wisdom.
Francis Bacon
Back to top
View user's profile Send private message
vixay



Joined: 12 Jun 2008
Posts: 51

PostPosted: Mon Apr 25, 2011 4:10 am    Post subject: upgrade Reply with quote

upgrade to 1.0.48 (the latest version) and then try
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group