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 

scroll lock disable button

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
AzraDark



Joined: 08 Mar 2008
Posts: 3

PostPosted: Sat Mar 08, 2008 11:04 pm    Post subject: scroll lock disable button Reply with quote

Hi, i been working on a little script, and I have been trying to code this so if the scroll lock is on, the script is disabled, so you can still send the original key, otherwise send the modified key. But I can not get the script to send the original function key.
Back to top
View user's profile Send private message
AzraDark



Joined: 08 Mar 2008
Posts: 3

PostPosted: Sun Mar 09, 2008 12:06 am    Post subject: Reply with quote

Figured I should post a sample of the coding Smile

Code:

GetFile(x)
{
  Test := GetKeyState("Scrolllock","T")
  if Test = 1
  {

  }
  else
  {
      FileRead, Contents, *t %x%
      if not ErrorLevel  ; Successfully loaded.
      {
        SendPlay, %Contents%
      }
  }
}

; Function Keys
F1::GetFile("f1.txt")

It reads the txt fine, but once I hit the scrolllock, so if I want to see the help file in notepad, it does nothing, so I need to send F1.
Back to top
View user's profile Send private message
Kellianjaxon



Joined: 04 Jan 2008
Posts: 39

PostPosted: Mon Mar 10, 2008 2:39 am    Post subject: Reply with quote

Code:
GetFile(x)
{
  Test := GetKeyState("Scrolllock","T")
  if Test = 1
  {
     Send, {F1} ; You never actually sent the key in your script
  }
  else
  {
      FileRead, Contents, *t %x%
      if not ErrorLevel  ; Successfully loaded.
      {
        SendPlay, %Contents%
      }
  }
}

; Function Keys
$F1::GetFile("f1.txt") ; $ added to prevent Send from making the hotkey trigger itself
Back to top
View user's profile Send private message
AzraDark



Joined: 08 Mar 2008
Posts: 3

PostPosted: Tue Mar 11, 2008 10:41 pm    Post subject: Reply with quote

Perfect!!! That $F1 was my issue.

Here is the completed working version.
Code:

GetFile(x,y)
{
  Test := GetKeyState("Scrolllock","T")
  if Test = 1
  {
   Send {%y%}
  }
  else
  {
      FileRead, Contents, *t %x%
      if not ErrorLevel  ; Successfully loaded.
      {
        SendPlay, %Contents%
      }
  }
}

; Function Keys

$F1::GetFile("f1.txt","F1")


than all i have to do is make a
$F2::GetFile("f2.txt","F2") etc etc Smile

Thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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