ganon64 Posted June 5, 2007 Posted June 5, 2007 it just ignores this completely and doesn't msg box or create the new file at all, it should extract variables from a txt document which it does but if this txt document doesn't exist i want it to create the txt document and quit the script so the user can enter the details into the txt document and restart the script. If FileExists("adsettings.txt") = 0 Then MsgBox(0, "Error", "adsettings.txt doesn't exist and has just been created, please add your details to it before running again.") $file = FileOpen("adsettings.txt",2) FileWriteLine($file,1) = "Directory" FileWriteLine($file,2) = "Username 1" FileWriteLine($file,3) = "Password 1" FileClose($file) Exit EndIf Dim $file = FileOpen("adsettings.txt",0) Dim $ABBYY = FileReadLine($file,1) Dim $username = FileReadLine($file,2) Dim $pw = FileReadLine($file,3) FileClose($file) HotKeySet( "{F8}", "paused") HotKeySet( "{F7}", "login") while 1 sleep(100) WEnd Func paused() $status = "paused" while $status = "paused" sleep(100) WEnd EndFunc Func login() $status = "started"
herewasplato Posted June 5, 2007 Posted June 5, 2007 (edited) check the help file for the correct syntax on: FileWriteLine($file, 1) = "Directory" Edit: still looking at the If line.... Edited June 5, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
danthe0 Posted June 5, 2007 Posted June 5, 2007 RE: The first post. Shift your Dim lines to the top of your script and yeah, format of FileWriteLine should be changed to FileWriteLine($file,"Directory") instead of FileWriteLine($file,1) = "Directory"
herewasplato Posted June 5, 2007 Posted June 5, 2007 (edited) tryIf Not FileExists("adsettings.txt") Then edit: If FileExists("adsettings.txt") = 0 Thenworked for me but only after I rewrote the line... Edited June 5, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
ganon64 Posted June 5, 2007 Author Posted June 5, 2007 thnx turns out i meant to use _FileWriteToLine instead actually not much difference but meh, anyway it still seems to not give me a msg box or anything or create the file like this, as if its ignoring the If FileExists line completely: #include <File.au3> Dim $file = FileOpen("adsettings.txt",0) Dim $ABBYY = FileReadLine($file,1) Dim $username = FileReadLine($file,2) Dim $pw = FileReadLine($file,3) If FileExists("adsettings.txt") = 0 Then MsgBox(0, "Error", "adsettings.txt doesn't exist and has just been created, please add your details to it before running again.") _FileCreate("adsettings.txt") FileOpen("adsettings.txt",2) _FileWriteToLine($file,1,"Directory",1) _FileWriteToLine($file,2,"Username 1",1) _FileWriteToLine($file,3,"Password 1",1) FileClose($file) Exit EndIf FileClose($file) HotKeySet( "{F8}", "paused") HotKeySet( "{F7}", "login") while 1 sleep(100) WEnd Func paused() $status = "paused" while $status = "paused" sleep(100) WEnd EndFunc Func login() $status = "started"
ganon64 Posted June 5, 2007 Author Posted June 5, 2007 nope wait was running some identical file script lol weird, it works just now i got weird other errors hehe here we go
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