Shifthappens Posted July 18, 2008 Posted July 18, 2008 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.
youknowwho4eva Posted July 18, 2008 Posted July 18, 2008 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
Shifthappens Posted July 18, 2008 Author Posted July 18, 2008 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.
Airwolf Posted July 18, 2008 Posted July 18, 2008 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
youknowwho4eva Posted July 18, 2008 Posted July 18, 2008 Yay so what I said was right muttley Giggity
Shifthappens Posted July 18, 2008 Author Posted July 18, 2008 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.
DjDeep00 Posted July 18, 2008 Posted July 18, 2008 @Shifthappens...Lets see what you got so far..post your code so we can help you...
JFee Posted July 18, 2008 Posted July 18, 2008 Look into the FileOpen function (and look at flag 2), then you can use FileWrite to write to the file you opened. Regards,Josh
Shifthappens Posted July 18, 2008 Author Posted July 18, 2008 (edited) @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 July 18, 2008 by Shifthappens
youknowwho4eva Posted July 18, 2008 Posted July 18, 2008 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
Shifthappens Posted July 18, 2008 Author Posted July 18, 2008 (edited) 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 WEndThat doesn't do anything besides make the file does it? Edit: Nvm, forgot to run in administrator, nice script there. Edited July 18, 2008 by Shifthappens
youknowwho4eva Posted July 18, 2008 Posted July 18, 2008 When you enter text, hit ok, close the program, reopen it the text you entered is in the text box Giggity
JFee Posted July 18, 2008 Posted July 18, 2008 As a Vista user myself, I strongly suggest shutting off UAC Regards,Josh
youknowwho4eva Posted July 18, 2008 Posted July 18, 2008 As a none Vista user, I'm holding on to my XP for dear life. Giggity
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now