Jump to content

Is this even possible?


Recommended Posts

I want to make it so in my autoit file, when it is ran, if you press F1 an input box will pop up asking for you to enter something to change a variable to. I want it to change the variable to whatever is typed, and then save it to the executable so in future openings it's already changed.

Link to comment
Share on other sites

I'm not 100% on this but I'm fairly sure you'd have to save the variable in an external ini file which you make equal to the text entered in the text box. Then when the program starts have it call that file. I personally dont know how to do this, and am actually trying to be able to do similar things currently.

Giggity

Link to comment
Share on other sites

I'm not 100% on this but I'm fairly sure you'd have to save the variable in an external ini file which you make equal to the text entered in the text box. Then when the program starts have it call that file. I personally dont know how to do this, and am actually trying to be able to do similar things currently.

Thanks for your input, i'll be searching through the help files. Hopefully somebody can help.

Link to comment
Share on other sites

You can use HotKeySet to run a function when F1 is pressed. The function can then set a variable based on an InputBox. The default value of the InputBox can be read from an INI file or RegRead. You can't modify the variable inside the executable without decompiling the source, modifying it, then recompiling it - which would require that you have AutoIt installed on every machine you run this on.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

You can use HotKeySet to run a function when F1 is pressed. The function can then set a variable based on an InputBox. The default value of the InputBox can be read from an INI file or RegRead. You can't modify the variable inside the executable without decompiling the source, modifying it, then recompiling it - which would require that you have AutoIt installed on every machine you run this on.

Okay now just help me get it working please. I'm trying out FileCreate, FileWrite, and everything and I am having trouble simply getting a .log file created.
Link to comment
Share on other sites

@Shifthappens...Lets see what you got so far..post your code so we can help you...

I'm probably going to look like a moron for this, but this is what i'm trying to work with.

HotKeySet("{F1}", "Test")

while 1
    sleep(100)
WEnd


Func Test()
IniWrite("C:\myfile.ini", "section2", "key", "this is a new value")
EndFunc

That's what I thought would write to a file, or if it didn't exist create a file as it says in the AutoItHelp directory.

Edit: Wow, I hate vista.. I wasn't running it in administrator so that's why i've had all of this trouble.. Thank you guys, and sorry about all of that.

Edited by Shifthappens
Link to comment
Share on other sites

Try this, I'm impressing myself today

#include <GUIConstantsEx.au3>

$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

GUICreate("Set INI")

    GUICtrlCreateLabel("whats the ini say?", 10, 20)
    $text = GUICtrlCreateInput($var, 10, 50)
    $ok = GUICtrlCreateButton("ok", 10, 80)
    GUISetState(@sw_show)     
    
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then
            ExitLoop
        ElseIf $msg = $ok Then
            IniWrite("C:\Temp\myfile.ini", "section2", "key", GUICtrlRead($text))
            EndIf
    WEnd

Giggity

Link to comment
Share on other sites

Try this, I'm impressing myself today

#include <GUIConstantsEx.au3>

$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

GUICreate("Set INI")

    GUICtrlCreateLabel("whats the ini say?", 10, 20)
    $text = GUICtrlCreateInput($var, 10, 50)
    $ok = GUICtrlCreateButton("ok", 10, 80)
    GUISetState(@sw_show)     
    
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then
            ExitLoop
        ElseIf $msg = $ok Then
            IniWrite("C:\Temp\myfile.ini", "section2", "key", GUICtrlRead($text))
            EndIf
    WEnd
That doesn't do anything besides make the file does it?

Edit: Nvm, forgot to run in administrator, nice script there.

Edited by Shifthappens
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...