retaly Posted September 29, 2012 Share Posted September 29, 2012 hy guys, (first i'd like to say i'm sorry for my last topic before this, i have been never red rules before this time, i'm sorry again, and ty for everything.) i'm using filewrite for save in my script, $save is one edit box what will going into something.ini file. FileWrite("something.ini", GUICtrlRead($save)) how can i do that: if something.ini file already exist, it cant rewrite the old something.ini and i get some message, for example msgbox, i'm almost ready with my first script what is rly interesting for me, but this thing still missing from script :S Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 29, 2012 Moderators Share Posted September 29, 2012 retaly,i'm sorry for my last topic before this, i have been never red rules before this timeWell, I hope you have read them now. As to writing an ini file - I suugest you take a look at the Ini* functions in the Help file. They make it really easy to save/read settings, etc in a file without worrying about FielRead/Write. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
retaly Posted September 29, 2012 Author Share Posted September 29, 2012 (edited) yes ofc i read. now i changed the file here in forum, in fact its one .dat file, and one dat file = one option for script, and i should to fix it, important thing how script not rewrite/change .dat file if its already exist "settings.dat, save.dat etc" if i wanna to save it again by my mistake it will give me a notice about file," its already exist and not possible to rewrite". part of my scrip, for example like this: _FileCreate("cfgname.dat") FileWrite("cfgname.dat", GUICtrlRead($cfg_options)) $server = 'ftp.myhost.com $username = 'mydomain' $pass = 'mypassword' $Open = _FTPOpen('minisha') $Conn = _FTPConnect($Open, $server, $username, $pass) $Ftpp = _FtpPutFile($Conn, @ScriptDir & "cfgname.dat", '/cfg/' & GUICtrlRead($give_name) &'.dat', 0x08000000) $Ftpc = _FTPClose($Open) nah this script do this: write one file in script dir: cfgname.dat, then write the options into it ($cfg_options) then connecting to my ftp and upload this file: cfgname.dat as i named($give_name) i hope do u understand me, i'm sorry for my bad english, i'm trying to explain for you what is my problem. :S Edited September 29, 2012 by retaly Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 29, 2012 Moderators Share Posted September 29, 2012 retaly,If all you want is to prevent overwriting a file, then use FilExists to see if it exists before writing ther new file. M23P.S. There is no need to create the file before using FileWrite, Autoit creates it for you automatically. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
retaly Posted September 30, 2012 Author Share Posted September 30, 2012 (edited) hy dear, i tryed out a lot of thing with fileexist, but i cant do it :S $server = 'ftp.myhost.com $username = 'mydomain' $pass = 'mypassword' $Open = _FTPOpen('myhost') $Conn = _FTPConnect($Open, $server, $username, $pass) $ftp_dir = '/cfg/' check() $Ftpp = _FtpPutFile($Conn, @ScriptDir & "cfgname.dat", $ftp_dir & GUICtrlRead($give_name) &'.dat', 0x08000000) $Ftpc = _FTPClose($Open) Func check() If FileExists($ftp_dir & GUICtrlRead($give_name)) Then MsgBox(4096, $give_name, "its exist!") Else MsgBox(4096, $give_name, "it isn't exist!") EndIf EndFunc Edited September 30, 2012 by retaly Link to comment Share on other sites More sharing options...
retaly Posted September 30, 2012 Author Share Posted September 30, 2012 triying to find out whats need to do since i posted here first, i have made a lot of idea here, but still nothing works :S please let me know how to do it. for example :Func check() If FileExists($Conn & $ftp_dir & GUICtrlRead($give_name)) &'.dat' = GUICtrlRead($give_name) &'.dat' Then MsgBox(0, $give_name, "its exist") Else MsgBox(0, $give_name, "it isn't exist") EndIf EndFunc Link to comment Share on other sites More sharing options...
retaly Posted September 30, 2012 Author Share Posted September 30, 2012 huh fixed it!! with fileread im so happy Link to comment Share on other sites More sharing options...
retaly Posted September 30, 2012 Author Share Posted September 30, 2012 (edited) hm how can i do it with fileexist? because fileread works well if the saved datas same as both example.dat file but if there is a bit differents in between two example.dat file it rewrite the older example.dat, but as i said, if datas same as both example.dat file it dont rewrite, giving msgbox.. and, if i make an ftp uploader, it works fine with normal characters: aaeou etc.. with: éáőöüóúű it doesnt work well, when uploading éá named file it looks :+!"!"+%"/.dat in ftp, but on my pc its éá.dat, with ea format it works when upload to ftp.. i hope u re understand me :S Func check() If FileRead(@ScriptDir & '' & GUICtrlRead($give_name) & '.dat') = InetRead("http://users.atw.hu/mydomain/" & $ftp_dir & GUICtrlRead($give_name) & ".dat", 1) Then ;FileExist ???????????????? :S or need another code for FileExist, maybe InetRead doesnt working for it... please help :( this is my last problem MsgBox(0, $give_name, "Its already exist") Else MsgBox(0, $give_name, "It isn't exist") EndIf Edited October 1, 2012 by retaly 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