 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
AzraDark
Joined: 08 Mar 2008 Posts: 3
|
Posted: Sat Mar 08, 2008 11:04 pm Post subject: scroll lock disable button |
|
|
| 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 |
|
 |
AzraDark
Joined: 08 Mar 2008 Posts: 3
|
Posted: Sun Mar 09, 2008 12:06 am Post subject: |
|
|
Figured I should post a sample of the coding
| 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 |
|
 |
Kellianjaxon
Joined: 04 Jan 2008 Posts: 39
|
Posted: Mon Mar 10, 2008 2:39 am Post subject: |
|
|
| 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 |
|
 |
AzraDark
Joined: 08 Mar 2008 Posts: 3
|
Posted: Tue Mar 11, 2008 10:41 pm Post subject: |
|
|
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
Thanks again. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|