AutoHotkey Community

It is currently May 26th, 2012, 8:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: August 30th, 2009, 2:07 am 
Offline

Joined: April 29th, 2009, 12:08 pm
Posts: 45
hey guys, i have started working on my password generator to work with my advanced config

the problem i am having is, nothing is being written to the end files

current code:
Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       WinAll
; Author:         Frosty <Snowman533@gmail.com>
;
; Script Function:
;   Password Generator, creates hard to crack passwords for use in online registrations
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

IniRead, Numv, settings.ini, settings, numbers
IniRead, Smlv, settings.ini, settings, sletters
IniRead, Cplv, settings.ini, settings, cletters

if Numv = 1 ;begin ini check, this checks to see if all options are set to 1 and continues as per normal
{
if Smlv = 1
{
if Cplv = 1
{
Inputbox,NumChars,No.Chars, What is the Minimum Number of Characters?
FileSelectFolder,SavePassTo
InputBox,SavePassAs, Save Password as?, please include the extension as well, eg: *.txt
Loop, %NumChars%
{
FileAppend,,%SavePassTo%/%SavePassAs%
Random,RValue,1,62
FileReadLine,ReadV,%A_WorkingDir%/PGC.txt,RValue
FileAppend,%ReadV%,%SavePassTo%/%SavePassAs%
}
}
}
}


the files are only written if the code is this:

Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       WinAll
; Author:         Frosty <Snowman533@gmail.com>
;
; Script Function:
;   Password Generator, creates hard to crack passwords for use in online registrations
;

Inputbox,NumChars,No.Chars, What is the Minimum Number of Characters?
FileSelectFolder,SavePassTo
InputBox,SavePassAs, Save Password as?, please include the extension as well, eg: *.txt ;unwanted, this stores the user inputed vars before the check is done

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

IniRead, Numv, settings.ini, settings, numbers
IniRead, Smlv, settings.ini, settings, sletters
IniRead, Cplv, settings.ini, settings, cletters

if Numv = 1
{
if Smlv = 1
{
if Cplv = 1
{
Loop, %NumChars%
{
FileAppend,,%SavePassTo%/%SavePassAs%
Random,RValue,1,62
FileReadLine,ReadV,%A_WorkingDir%/PGC.txt,RValue
FileAppend,%ReadV%,%SavePassTo%/%SavePassAs%
}
}
}
}


but, i dont want the variables to be set until the ini check has been done

please help, this is getting annoying, i cannot see what would be stopping the script from writing to file with the first piece of code

*edit* unless i simply expand on the code that does work and implement the rest of the code...

problem is, i want to implement error messages, so i dont want the user inputted vars to be saved before the ini check is done so that it displays the error messages without asking for user input if the options are set to something that the password gen wont work with (all options 0 for example)

_________________
frosty the snowman

Ex-AutoIt user

class: intermediate


Last edited by fro01 on August 30th, 2009, 3:02 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 2:52 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
This is better and should work, your current code is very dirty.

Instead of forward slash, use backslash.

Code:
;
#NoEnv  ; Recommended for performance and compatibility with future
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

IniRead, Numv, settings.ini, settings, numbers
IniRead, Smlv, settings.ini, settings, sletters
IniRead, Cplv, settings.ini, settings, cletters

if (Numv == "1" && Smlv == "1" && Cplv = "1"
{

Inputbox,NumChars,No.Chars, What is the Minimum Number of Characters?
FileSelectFolder,SavePassTo
InputBox,SavePassAs, Save Password as?, please include the extension as well, eg: *.txt
Loop, %NumChars%
{
FileAppend,,%SavePassTo%\%SavePassAs%
Random,RValue,1,62
FileReadLine,ReadV,%A_WorkingDir%\PGC.txt,RValue
FileAppend,%ReadV%,%SavePassTo%\%SavePassAs%
}
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 3:00 am 
Offline

Joined: April 29th, 2009, 12:08 pm
Posts: 45
oops, PGC.txt was missing, tx for the reply tho

i appreciate it, much neater than my code :)

_________________
frosty the snowman

Ex-AutoIt user

class: intermediate


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2009, 3:01 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
Ok

Kind Regards

I also pmed you.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], coinman, Google [Bot], joetazz, Leef_me, Yahoo [Bot] and 58 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group