Jump to content

Ini modification on key detected?


Recommended Posts

Hi,

im a new user and im starting to learn about AHK.

I want to make a simple script with these processes:
1. When the "5" key is detected, modify a line from a ini i got that permits the user to open a process. Something like a variable with newline and old line?
2. After a time, lets say 5 minutes, the script should return for example "ESC", and wait for another "5" key, which is the native status of the script.
3. (optional) if another 5 is pressed, add another 5 minutes to the restarting amount of time.
4. (optional) show a gui with the current remaining time.

I know its complex but i just need a little push.

Thank you!!

Link to comment
Share on other sites

@Dhanbb

If you want to learn AHK, why don't you post your request in an AHK forum?  You do realize this is an AutoIt forum don't you?  If you want to learn AutoIt, then I would start with getting familiar with the help file and the search function of the forum.

Edited by TheXman
Link to comment
Share on other sites

You can use something like:

HotKeySet("{ESC}", "_ExitScript")
HotKeySet("6", "_EndTimer")
HotKeySet("5", "_StartTimer")

Global $hTimer, $fTimer = 0, $bTimer = False
Global $sIniProcess = @ScriptDir & "\Process.ini" ;~ Ini File Path

While 1
    Sleep(100)
WEnd

Func _StartTimer()
    $bTimer = True
    $hTimer = TimerInit() ;~ Begin the timer and store the handle in a variable
    IniWrite($sIniProcess, "Process", "Notepad.exe", True)
    While 1
        $fTimer = Round(TimerDiff($hTimer), 0)
        If $fTimer >= 10000 Or $bTimer = False Then
            $bTimer = False
            IniWrite($sIniProcess, "Process", "Notepad.exe", False)
            ExitLoop
        EndIf
    WEnd
EndFunc

Func _EndTimer()
    $bTimer = False
EndFunc

Func _ExitScript()
    Exit
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...