AutoHotkey Community

It is currently May 26th, 2012, 4:41 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 70  Next
Author Message
 Post subject:
PostPosted: March 29th, 2009, 10:40 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2009, 11:17 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 12:02 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 1:40 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 2:22 pm 
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 :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 2:45 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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. :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 5:07 pm 
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%}
   }
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 30th, 2009, 10:49 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
{U+0x...} is inconsistent with what Character Map shows character values as. I don't see the need to support decimal.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 4:38 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
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
      }
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 4:52 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 5:47 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
this is my code
http://www.autohotkey.net/~rexx/FolderM ... erMenu.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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2009, 5:57 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
oh i found that if i dereference the %SystemRoot% in the variable then it works.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2009, 2:32 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
rexx wrote:
so can i know which method it uses?
No. That was my point.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 6th, 2009, 10:55 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 7th, 2009, 9:05 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
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?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 70  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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