AutoHotkey Community

It is currently May 26th, 2012, 4:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 22nd, 2008, 3:59 pm 
Offline

Joined: January 21st, 2008, 1:29 pm
Posts: 9
hi, my name is juan pablo, from argentina, I´m presenting my self because it´s my first time here.
First off all, I´m gladly surprised with autoHotKey, and specially with the people of this forum, glad to be here

I'm playing with a automation script and can not figure out why this doesnt work:
SetTitleMatchMode, 2
#IfWinActive, Firefox
#g::MsgBox, hola
#IfWinActive

and this does:
SetTitleMatchMode, 2
#IfWinActive, ahk_class MozillaUIWindowClass
#g::MsgBox, hola
#IfWinActive

here is the entire script:
Code:
;#include vol.ahk
SetKeyDelay , -1, -1
#SingleInstance force
return
;Varias
~RButton & LButton::AltTab
#a:: run, C:\tools\runapp\runapps.exe
#m::
   SetTitleMatchMode, regex
   result :=    WinExist("mp3 @ C:\.* - xplorer²")
   if %result%
      WinActivate
   else
      Run, C:\Archivos de programa\zabkat\xplorer2\xplorer2_UC.exe "c:\data\mp3"
      
return
#f::
   SetTitleMatchMode, regex
   result :=    WinExist(".* - Mozilla Firefox$")
   if %result%
      WinActivate
   else
      Run, C:\Archivos de programa\Mozilla Firefox\firefox.exe
return

;********************************
; this is what doesn´t work!!!

SetTitleMatchMode, Regex
#IfWinActive,.* - Mozilla Firefox$
!g::
   clip = ClipboardAll
   clipboard=
   SendInput, ^c
   ClipWait, 1
   if ErrorLevel
   {
      MsgBox, No se pudo copiar al portapapeles
      return
   }
   busca := clipboard
   url := "http://www.google.com.ar/search?q=" . busca . "&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:es-AR:official&client=firefox-a"
   run, %url%
   clipboard = clip
   clip=
#IfWinActive
; a return is necesary here????

#c::
   SetTitleMatchMode, regex
   result :=    WinExist(",* - xplorer²$")
   if %result%
      WinActivate
   else
      Run, "C:\Archivos de programa\zabkat\xplorer2\xplorer2_UC.exe"
return

;**************************************************************
; clipmate
;
~#v::
   Send, ^V
   sleep 200
   Send, ^!n
return
~^!n::
   sleep 300
   a := Clipboard
   a := substr(a, 1, 1000)
   ToolTip %a%
   SetTimer, RemoveToolTip, 1000
return
~^!p::
   sleep 300
   a := Clipboard
   a := substr(a, 1, 1000)
   ToolTip %a%
   SetTimer, RemoveToolTip, 1000
return
RemoveToolTip:
   SetTimer, RemoveToolTip, Off
   ToolTip
return

thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2008, 5:04 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
set once at beggining: SetTitleMatchMode RegEx

change: #IfWinActive,.* - Mozilla Firefox$
to: #IfWinActive ahk_class .*Mozilla Firefox

return is necessary before last #IfWinActive to finish !g::

and you have posted in wrong section :]

[Moderator's note: moved...]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 25th, 2008, 2:30 pm 
Offline

Joined: January 21st, 2008, 1:29 pm
Posts: 9
k3ph, thanks for the reply
some more questions:
>and you have posted in wrong section
this forum says "ask for help", so, wy is the wrong place?


>set once at beggining: SetTitleMatchMode RegEx
is that the only way, I mean, you cannot use it only for a particular horkey?

>change: #IfWinActive,.* - Mozilla Firefox$
>to: #IfWinActive ahk_class .*Mozilla Firefox
but the first is what i want, the two are two diferent things, one searchs in the title and the oter in the classname, in the case of firefox it's ok to use the classname, but what i really whant is to know why the firstone didn´t work

Thanks for your answer and sorry for my english, its primitive

return is necessary before last #IfWinActive to finish !g::

:P


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2008, 12:15 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
jpsala wrote:
k3ph, thanks for the reply
some more questions:
>and you have posted in wrong section
this forum says "ask for help", so, wy is the wrong place?

moderator has moved to 'ask for help', it was located on "script & functions" and you are welcome.

jpsala wrote:
>set once at beggining: SetTitleMatchMode RegEx
is that the only way, I mean, you cannot use it only for a particular horkey?

yes you can, but you might need specify only when the mode changes. Well, I thought in that script you just needed one there wasn't another, so make it simple.

jpsala wrote:
>change: #IfWinActive,.* - Mozilla Firefox$
>to: #IfWinActive ahk_class .*Mozilla Firefox
but the first is what i want, the two are two diferent things, one searchs in the title and the oter in the classname, in the case of firefox it's ok to use the classname, but what i really whant is to know why the firstone didn´t work


hmm, try:
Code:
#IfWinActive, .*Mozilla Firefox

Note: for some reason to handle Firefox things sometimes are just problematic.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2008, 1:05 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
k3ph wrote:
jpsala wrote:
>set once at beggining: SetTitleMatchMode RegEx
is that the only way, I mean, you cannot use it only for a particular horkey?

yes you can, but you might need specify only when the mode changes.
No, you cannot... #IfWin is processed when the script starts, before the auto-execute section starts, so before SetTitleMatchMode may be called. #IfWin merely sets criteria for hotkeys. SetTitleMatchMode affects all windowing commands, and if called from the auto-execute section, it also affects evaluation of hotkey criteria.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2008, 2:25 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
but he can use SetTitleMatchMode for another function besides #IfWinActive

check http://www.autohotkey.com/forum/viewtop ... ght=hotkey


Last edited by k3ph on March 26th, 2008, 4:56 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2008, 4:06 am 
Offline

Joined: January 21st, 2008, 1:29 pm
Posts: 9
thanks for the replays :) I´ll use your help


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, Exabot [Bot], Yahoo [Bot] and 13 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