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 

AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression ...
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 68, 69, 70  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
emm386
Guest





PostPosted: Sun Mar 29, 2009 9:40 am    Post subject: Reply with quote

Hi, I have a weird problem with this script. I can't type anything in Gui Edit. Would you help me?
(tested AutoHotkey and AutoHotkey_L Rev22, not worked AutoHotkey_L)

Code:

Gui, -MinimizeBox
Gui, Margin, 10, 10
Gui, Add, Text, xm ym h15, Type URL:
Gui, Add, Edit, xp y+5 w300 r1 vEdit gEdit
Gui, Add, Button, xm+225 y+10 w75 h25 Disabled, Open URL
Gui, Show
Return

Edit:
GuiControlGet, Edit
GuiControl, % (RegExMatch(Edit, "i)^(\w+://)?[\w\-]{2,}(?:\.[\w\-]{2,})+")) ? "Enable" : "Disable", Button1
Return

ButtonOpenURL:
GuiControlGet, Edit
Run, %Edit%,, UseErrorLevel
Return

GuiClose:
GuiEscape:
ExitApp
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sun Mar 29, 2009 10:17 am    Post subject: Reply with quote

It seems to be a side-effect of a "workaround" I added in revision 13. I'll remove the workaround when I get more time. For now you can work around it by using EnableWindow:
Code:
Gui, -MinimizeBox
Gui, Margin, 10, 10
Gui, Add, Text, xm ym h15, Type URL:
Gui, Add, Edit, xp y+5 w300 r1 vEdit gEdit
Gui, Add, Button, xm+225 y+10 w75 h25 Disabled hwndhbtn, Open URL
Gui, Show
Return

Edit:
GuiControlGet, Edit
DllCall("EnableWindow", "uint", hbtn, "int", !!RegExMatch(Edit, "i)^(\w+://)?[\w\-]{2,}(?:\.[\w\-]{2,})+"))
Return

ButtonOpenURL:
GuiControlGet, Edit
Run, %Edit%,, UseErrorLevel
Return

GuiClose:
GuiEscape:
ExitApp
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Mar 30, 2009 11:02 am    Post subject: Reply with quote

Quote:
Revision 23 - March 30, 2009
  • Fixed: GuiControl, Enable/Disable now only resets focus if the focused control was disabled.
Revision 22 - March 26, 2009
  • Optimized If var [not] in/contains MatchList, especially for long lists containing shorter fields.

emm386, please try your script with the latest revision.
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Mar 30, 2009 12:40 pm    Post subject: Reply with quote

Quote:
Revision 24 - March 30, 2009
  • Added: Support for Send {U+xxxx}. SendInput() is used where available for proper unicode support, otherwise falls back to Alt+Numpad.

For example, the following remaps u to ů and U to Ů:
Code:
u::Send {U+016F}
+u::Send {U+016E}
U+xxxx values are as shown by Character Map (usually in Programs -> Accessories -> System Tools).
Back to top
View user's profile Send private message Visit poster's website
emm386
Guest





PostPosted: Mon Mar 30, 2009 1:22 pm    Post subject: Reply with quote

Quote:

Revision 23 - March 30, 2009

Fixed: GuiControl, Enable/Disable now only resets focus if the focused control was disabled.


Works perfectly, thanks very much Lexikos Very Happy
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Mar 30, 2009 1:45 pm    Post subject: Reply with quote

Quote:
Revision 25 - March 30, 2009
  • Fixed: Send {U+xxxx} correctly sets modifier key-state as with any normal key.
  • Fixed: Send {U+..xx} no longer triggers hotkey SCxx.

This should be the last update today... It is 23:45 here, after all. Laughing
Back to top
View user's profile Send private message Visit poster's website
emm386
Guest





PostPosted: Mon Mar 30, 2009 4:07 pm    Post subject: Reply with quote

Quote:
Revision 24 - March 30, 2009

Support for Send {U+xxxx}. SendInput() is used where available for proper unicode support, otherwise falls back to Alt+Numpad.

It looks great for unicode support! How about support Decimal and Hexadecimal numbers for {U+xxxx}
like this..
Code:
Send, {U+0x016F} ; hexadecimal
Send, {U+367} ; decimal


This is a sample that I supposed..
Code:
SendU(sStr, CP = 0) ; Ansi = 0, UTF-8 = 65001
{
   nLen := DllCall("MultiByteToWideChar", "UInt", CP, "UInt", 0, "UInt", &sStr, "Int", -1, "UInt", 0, "Int", 0)
   VarSetCapacity(wStr, nLen * 2, 0)
   DllCall("MultiByteToWideChar", "UInt", CP, "UInt", 0, "UInt", &sStr, "Int", -1, "UInt", &wStr, "Int", nLen)
   Loop, % nLen - 1
   {
      Code := NumGet(wStr, 2 * (A_Index - 1), "UShort")
      
      SetFormat, Integer, Hex ; Useless if Send {U+xxxx} support decimal
      Code += 0 ; Also
      Code := RegExReplace(Code, "^0x") ; Also
      SetFormat, Integer, D ; Also
      
      SendInput, {U+%Code%}
   }
}
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Mar 30, 2009 9:49 pm    Post subject: Reply with quote

{U+0x...} is inconsistent with what Character Map shows character values as. I don't see the need to support decimal.
Back to top
View user's profile Send private message Visit poster's website
rexx



Joined: 28 Feb 2006
Posts: 72

PostPosted: Fri Apr 03, 2009 3:38 pm    Post subject: Reply with quote

thanks for the menu icon support, that's beautiful.
but i found some problems.

sometimes the size of icon (with multiple sizes in one icon) is not correctly chosen.
for example i use the icon C:\Windows\System32\shell32.dll, 4 (folder icon)(windows 7)
it has three sizes 16, 32, 48, and i specify the width = 16, but it choose the 32 one and scale it down to 16, so it looks not very good.

by the way here's a function i wrote to get the associated file type icon of a file.
that is, how the file looks like in the explorer.

Code:

f_GetIcon(Path)
{
   if InStr(FileExist(Path), "D") ; it's a folder, use folder icon
   {
      RegRead, IconPath, HKEY_CLASSES_ROOT, Folder\DefaultIcon
      return IconPath
   }
   else ; a file, use its icon
   {
      SplitPath, Path, , , ThisExtension
      if InStr(Path, "http://") or InStr(Path, "https://")
         ThisExtension = url
      if ThisExtension =
         return
      if ThisExtension = lnk
      {
         FileGetShortcut, %Path%, TargetPath, , , , IconPath, IconIndex
         if IconPath !=
            return IconPath . "," . IconIndex
         else
            return f_GetIcon(TargetPath)
      }
      else{
         RegRead, FileType, HKEY_CLASSES_ROOT, .%ThisExtension%
         RegRead, IconPath, HKEY_CLASSES_ROOT, %FileType%\DefaultIcon
         if IconPath = `%1 ; the file icon is itself
            return Path
         else
            return IconPath
      }
   }
}
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Fri Apr 03, 2009 3:52 pm    Post subject: Reply with quote

rexx wrote:
for example i use the icon C:\Windows\System32\shell32.dll, 4 (folder icon)(windows 7)
it has three sizes 16, 32, 48, and i specify the width = 16, but it choose the 32 one and scale it down to 16, so it looks not very good.
What code did you use? It works on my end:
Code:
Menu, M, Add, Test
Menu, M, Icon, Test, shell32.dll, 4, 16 ; ", 16" can be omitted
Menu, M, Show
Test:
ExitApp
Btw, I do not control which icon size is used - LookupIconIdFromDirectoryEx is used to pick the icon from the icon group. If it loads the 32x32 icon on your system, perhaps something is preventing it from loading the file or extracting the icon resource - in that case, it would fall back to the old method which probably uses the system large icon size.
Quote:
by the way here's a function i wrote to get the associated file type icon of a file.
Thanks.
Back to top
View user's profile Send private message Visit poster's website
rexx



Joined: 28 Feb 2006
Posts: 72

PostPosted: Fri Apr 03, 2009 4:47 pm    Post subject: Reply with quote

this is my code
http://www.autohotkey.net/~rexx/FolderMenu/090403_FolderMenu.ahk
http://www.autohotkey.net/~rexx/FolderMenu/Default.ini (rename it to config.ini)
maybe you have to delete some lines to get it works(some icons do not exist)
folder icon at line 292

Lexikos wrote:

Btw, I do not control which icon size is used - LookupIconIdFromDirectoryEx is used to pick the icon from the icon group. If it loads the 32x32 icon on your system, perhaps something is preventing it from loading the file or extracting the icon resource - in that case, it would fall back to the old method which probably uses the system large icon size.


so can i know which method it uses?
Back to top
View user's profile Send private message
rexx



Joined: 28 Feb 2006
Posts: 72

PostPosted: Fri Apr 03, 2009 4:57 pm    Post subject: Reply with quote

oh i found that if i dereference the %SystemRoot% in the variable then it works.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Sat Apr 04, 2009 1:32 am    Post subject: Reply with quote

rexx wrote:
so can i know which method it uses?
No. That was my point.
Back to top
View user's profile Send private message Visit poster's website
tinku99



Joined: 03 Aug 2007
Posts: 513
Location: Houston, TX

PostPosted: Mon Apr 06, 2009 9:55 pm    Post subject: Hotkey If [, Expression ] version for #If [, Expression ] Reply with quote

can it be possible to use arbitrary if expressions to create dynamic hotkey variants as follows?

Code:
Hotkey, If MouseIsOver("ahk_class Shell_TrayWnd")
Hotkey, ^!c, MyLabelForNotepad
Hotkey, If ActiveControlIsOfClass("Edit")
Hotkey, ^!c, MyLabelForWordPad
Back to top
View user's profile Send private message Send e-mail Visit poster's website
emmanuel d



Joined: 29 Jan 2009
Posts: 436
Location: Belgium

PostPosted: Tue Apr 07, 2009 8:05 pm    Post subject: menu icon not working for menuitems with subitems Reply with quote

menu icon not working for menuitems with subitems

can you confirm this?
it does not create an error, it continues but shows no icons for menuitems with subitems. Subitems do have their icons

Code:

Menu, M, Add, Test
Menu, M, Icon, Test, shell32.dll, 4, 16 ; ", 16" can be omitted
Menu, N, Add, Test,:M
Menu, N, Icon, Test, shell32.dll, 4, 16 ; ", 16" can be omitted
Menu, N, Show
Test:
ExitApp


sugestion, if no icon is specified can you make it give no error so if
my var is empty it can continue without my checking that first?
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 8, 9, 10 ... 68, 69, 70  Next
Page 9 of 70

 
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