gigilihooie Posted November 28, 2008 Share Posted November 28, 2008 (edited) Ok, I know this is VERY simple (and I know I did it yesterday) but I cant get it now. I looked through all the help files and couldnt get it. I want inputbox which you can input some text, press the go button and it replaces a piece of text in a text file. #include <GUIConstantsEx.au3> #Include <File.au3> Opt("TrayIconHide", 1) GUICreate("", 131, 100, -1, -1) $string = GUICtrlCreateInput("", 5, 10, 100, 20) $go = GUICtrlCreateButton("go", 5, 40, 30, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $go _ReplaceStringInFile("string.txt", "Ok", $string) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Dont judge me Edited November 28, 2008 by gigilihooie Link to comment Share on other sites More sharing options...
GEOSoft Posted November 28, 2008 Share Posted November 28, 2008 Ok, I know this is VERY simple (and I know I did it yesterday) but I cant get it now. I looked through all the help files and couldnt get it. I want inputbox which you can input some text, press the go button and it replaces a piece of text in a text file. #include <GUIConstantsEx.au3> #Include <File.au3> Opt("TrayIconHide", 1) GUICreate("", 131, 100, -1, -1) $string = GUICtrlCreateInput("", 5, 10, 100, 20) $go = GUICtrlCreateButton("go", 5, 40, 30, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $go _ReplaceStringInFile("string.txt", "Ok", $string) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Dont judge me Here come da judge. $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileWrite($oFile, $sStr) FileClose($oFile) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Valuater Posted November 28, 2008 Share Posted November 28, 2008 Here come da judge. $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileWrite($oFile, $sStr) FileClose($oFile) @George *** I went to your site ( looks nice ) clicked on Contact and then later I clicked on About. The about link from the contact page kinks to a plain white page Thought you might like to know 8) Link to comment Share on other sites More sharing options...
GEOSoft Posted November 28, 2008 Share Posted November 28, 2008 (edited) @George ***I went to your site ( looks nice ) clicked on Contact and then later I clicked on About. The about link from the contact page kinks to a plain white pageThought you might like to know8)Thanks. What browser? I had that problem in FF last week and I thought I fixed it, if not then I'll look again.Oh, wait a sec. Did you click the About from the Contact page? If so then that page has the same problem as the one I fixed the other day and I'll correct it the same way. It's a typo where I entered \ instead of /. IE is forgiving on that but not FF.Can you try it from the Main page?ThanksNMI could have sworn that I did a Global Search & replace for that against the site. Would have been swearing for nothing. It's fixed now. Thanks @Val Edited November 28, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Valuater Posted November 28, 2008 Share Posted November 28, 2008 All is good now!! 8) Link to comment Share on other sites More sharing options...
GEOSoft Posted November 28, 2008 Share Posted November 28, 2008 All is good now!!8)Thanks @Val. I would have probably never noticed because I seldom go to the site using FF and I most assuredly would not have checked the Contacts page. Of course I do have a link verifyer but I never think to use it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gigilihooie Posted November 29, 2008 Author Share Posted November 29, 2008 (edited) Worked Perfect, thank you mate. Would it be possable to make it read\wright to the file when it is hidden? Edited November 29, 2008 by gigilihooie Link to comment Share on other sites More sharing options...
GEOSoft Posted November 29, 2008 Share Posted November 29, 2008 Worked Perfect, thank you mate.Would it be possable to make it read\wright to the file when it is hidden?It should be. Post your working code again so we can look at it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gigilihooie Posted November 29, 2008 Author Share Posted November 29, 2008 #include <GUIConstantsEx.au3> #Include <File.au3> Opt("TrayIconHide", 1) GUICreate("", 131, 100, -1, -1) $string = GUICtrlCreateInput("", 5, 10, 100, 20) $go = GUICtrlCreateButton("go", 5, 40, 30, 20) GUISetState() FileSetAttrib("string.txt", "H") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $go $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileWrite($oFile, $sStr) FileClose($oFile) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
GEOSoft Posted November 29, 2008 Share Posted November 29, 2008 #include <GUIConstantsEx.au3> #Include <File.au3> Opt("TrayIconHide", 1) GUICreate("", 131, 100, -1, -1) $string = GUICtrlCreateInput("", 5, 10, 100, 20) $go = GUICtrlCreateButton("go", 5, 40, 30, 20) GUISetState() FileSetAttrib("string.txt", "H") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $go $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileWrite($oFile, $sStr) FileClose($oFile) Case $GUI_EVENT_CLOSE Exit EndSwitch WEndNo problem with that. It will work. Also don't forget that you can set/unset File attribs as required shoud that become necessary. FileSetAttrib("string.txt", "+HR") FileSetAttrib("string.txt","-R") FileWrite("string.txt", "Some string") FileSetAttrib("string.txt","+R") BTW: So far you have no code in there that requires the file.au3 file that you #included. FileSetAttrib and FileWrite are built-in functions. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gigilihooie Posted November 29, 2008 Author Share Posted November 29, 2008 (edited) Thank you very much, and I know, that is just the 1/100th of the code. How would I put that in my code? Something like. Case $go $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileSetAttrib("string.txt", "+HR") FileSetAttrib("string.txt","-R") FileWrite($oFile, $sStr) FileSetAttrib("string.txt","+R") FileClose($oFile)? Edited November 29, 2008 by gigilihooie Link to comment Share on other sites More sharing options...
GEOSoft Posted November 29, 2008 Share Posted November 29, 2008 (edited) Thank you very much, and I know, that is just the 1/100th of the code. How would I put that in my code? Something like. Case $go $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) $oFile = FileOpen("String.txt", 2) FileSetAttrib("string.txt", "+HR") FileSetAttrib("string.txt","-R") FileWrite($oFile, $sStr) FileSetAttrib("string.txt","+R") FileClose($oFile)?If you are going to use FileOpen() then you have to set the attribs BEFORE that line and AFTER The FileClose. Case $go $sStr = FileRead("String.Txt") $sStr = StringReplace($sStr, "OK", GUICtrlRead($String)) ;;FileSetAttrib("string.txt", "+HR");; If this is already the right attribs then no need for this ;; it was only used as an example FileSetAttrib("string.txt","-R") $oFile = FileOpen("String.txt", 2) FileWrite($oFile, $sStr) FileClose($oFile) FileSetAttrib("string.txt","+R") Edited November 29, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
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