Hawkwing Posted January 18, 2009 Share Posted January 18, 2009 I want to make some scripts that automate things that have username and password. I want to have it create a place for you to enter your username and password and save them so you don't have to enter them again. But I also want to have set a hotkey to change the username and password that it will use. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 18, 2009 Developers Share Posted January 18, 2009 Ok, but what is it are you having a problems with? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 18, 2009 Author Share Posted January 18, 2009 I can make the gui that asks for the username and password, I just don't know how to have it save these so that I don't have to re-enter them every time I run it. I also don't know how to set up a hotkey to change the username and password. I have used hotkeys before, I just don't know how to make it change the saved username and password. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
CodyBarrett Posted January 19, 2009 Share Posted January 19, 2009 check out iniwrite and iniread, or just keep that exe running all the time and assign the controls to variables [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Hawkwing Posted January 22, 2009 Author Share Posted January 22, 2009 (edited) OK, I'm making this so that I can later edit it to use for different things. This is what I have so far. CODE#include <GUIConstantsEx.au3> #include <EditConstants.au3> $nameofappfolder = "" ;Write the name of the app folder here. NOTE: this assumes that the folder is located in the Program Files folder on your C drive. $nameofapp = "" ;Write the name of the executable file here WITHOUT the .exe at the end. If Not FileExists ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Then FileOpen ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") FileClose ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Opt ("GUIOnEventMode", 1) GUICreate ("Enter your Username and Password", 200, 140, 200, 200) GUICtrlCreateLabel ("Enter Username", 5, 5) GUICtrlCreateLabel ("Enter Password", 5, 40) GUICtrlCreateLabel ("Enter File Location", 5, 75) $inputuser = GUICtrlCreateInput ("", 5, 18, 190) $inputpass = GUICtrlCreateInput ("", 5, 53, 190, , $ES_PASSWORD) $inputfilelocation = GUICtrlCreateInput ("", 5, 88, 190) $userpassok = GUICtrlCreateButton ("OK", 5, 113, 190) GUICtrlSetOnEvent (-1, "userpassok") GUISetState (@SW_SHOW) EndIf FileOpen ("C:\Program Files\$nameofappfolder\"$nameofapp.exe"") Sleep (2000) MouseClick ("left", , ) ;put the x and y coordinates of the username box Send ($readfilelocation) Func userpassok () $readuser = GUICtrlRead ($inputuser) $readpass = GUICtrlRead ($inputpass) $readfilelocation = GUICtrlRead ($inputfilelocation) IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp", ""Username", ""$readuser"") IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp"", "Password", ""$readpass"") IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp"", "File Location", ""$readfilelocation"") EndFunc it has an error on line 21 (If Not FileExists ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Then) that says variable must me of type "Object". Edited January 22, 2009 by pigeek The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 22, 2009 Moderators Share Posted January 22, 2009 (edited) OK, I'm making this so that I can later edit it to use for different things. This is what I have so far. CODE#include <GUIConstantsEx.au3> #include <EditConstants.au3> $nameofappfolder = "" ;Write the name of the app folder here. NOTE: this assumes that the folder is located in the Program Files folder on your C drive. $nameofapp = "" ;Write the name of the executable file here WITHOUT the .exe at the end. If Not FileExists ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Then FileOpen ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") FileClose ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Opt ("GUIOnEventMode", 1) GUICreate ("Enter your Username and Password", 200, 140, 200, 200) GUICtrlCreateLabel ("Enter Username", 5, 5) GUICtrlCreateLabel ("Enter Password", 5, 40) GUICtrlCreateLabel ("Enter File Location", 5, 75) $inputuser = GUICtrlCreateInput ("", 5, 18, 190) $inputpass = GUICtrlCreateInput ("", 5, 53, 190, , $ES_PASSWORD) $inputfilelocation = GUICtrlCreateInput ("", 5, 88, 190) $userpassok = GUICtrlCreateButton ("OK", 5, 113, 190) GUICtrlSetOnEvent (-1, "userpassok") GUISetState (@SW_SHOW) EndIf Func userpassok () $readuser = GUICtrlRead ($inputuser) $readpass = GUICtrlRead ($inputpass) $readfilelocation = GUICtrlRead ($inputfilelocation) IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp", ""Username", ""$readuser"") IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp"", "Password", ""$readpass"") IniWrite ("C:\Program Files\UserPassAU3\"$nameofapp.ini", "$nameofapp"", "File Location", ""$readfilelocation"") FileOpen ("C:\Program Files\$nameofappfolder\"$nameofapp.exe"") Sleep (2000) MouseClick ("left", , ) ;put the x and y coordinates of the username box Send ($readfilelocation) EndFunc it has an error on line 21 (If Not FileExists ("C:\Program Files\UserPassAU3\"$nameofapp.ini"") Then) that says variable must me of type "Object".You have to learn how to properly concatenate strings with variables and such:If Not FileExists(@ProgramFilesDir & "\UserPassAU3\" & $nameofapp.ini) Then Edited January 22, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 22, 2009 Author Share Posted January 22, 2009 Thanks, I'll try and fix it. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 22, 2009 Author Share Posted January 22, 2009 (edited) Aha, I finally got it! Here's the script. CODE#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <File.au3> HotKeySet ("{printscreen}", "changeini") $nameofini = ".ini" ;Write the name of the executable file here but replace the .exe with .ini If Not FileExists (@ProgramFilesDir & "\UserPassAU3\" & $nameofini) Then _FileCreate (@ProgramFilesDir & "\UserPassAU3\" & $nameofini) Opt ("GUIOnEventMode", 1) $UandPgui = GUICreate ("Enter U & P", 200, 140, 200, 200) GUICtrlCreateLabel ("Enter Username", 5, 5) GUICtrlCreateLabel ("Enter Password", 5, 40) GUICtrlCreateLabel ("Enter File Location", 5, 75) $inputuser = GUICtrlCreateInput ("", 5, 18, 190) $inputpass = GUICtrlCreateInput ("", 5, 53, 190, "", $ES_PASSWORD) $inputfilelocation = GUICtrlCreateInput ("", 5, 88, 190) $userpassok = GUICtrlCreateButton ("OK", 5, 113, 190) GUICtrlSetOnEvent (-1, "userpassok") GUISetState (@SW_SHOW) WinWaitClose ("Enter U & P") EndIf $iniuser = IniRead (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "Username", "No Username") $inipass = IniRead (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "Password", "No Password") $inifilelocation = IniRead (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "File Location", "No Username") Sleep (2000) RunWait ($inifilelocation) MouseClick ("left", , ) ;put the x and y coordinates of the username box Sleep (100) Send ($iniuser) Sleep (100) Send ("{tab}") Sleep (100) Send ($inipass) Sleep (100) Send ("{enter}") Func userpassok () $readuser = GUICtrlRead ($inputuser) $readpass = GUICtrlRead ($inputpass) $readfilelocation = GUICtrlRead ($inputfilelocation) IniWrite (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "Username", $readuser) IniWrite (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "Password", $readpass) IniWrite (@ProgramFilesDir & "\UserPassAU3\" & $nameofini, $nameofini, "File Location", $readfilelocation) GUIDelete ($UandPgui) EndFunc Func changeini () Opt ("GUIOnEventMode", 1) GUICreate ("Enter your Username and Password", 200, 140, 200, 200) GUICtrlCreateLabel ("Enter Username", 5, 5) GUICtrlCreateLabel ("Enter Password", 5, 40) GUICtrlCreateLabel ("Enter File Location", 5, 75) $inputuser = GUICtrlCreateInput ("", 5, 18, 190) $inputpass = GUICtrlCreateInput ("", 5, 53, 190, "", $ES_PASSWORD) $inputfilelocation = GUICtrlCreateInput ("", 5, 88, 190) $userpassok = GUICtrlCreateButton ("OK", 5, 113, 190) GUICtrlSetOnEvent (-1, "userpassok") GUISetState (@SW_SHOW) WinWaitClose ("Enter U & P") EndFunc I decided not to have the username box x,y coordinates be variables, so I'll have to edit the script when I want to adapt it to anything, but at least it works! Thanks SmOke_N, and bob00037 for the help! Edited January 22, 2009 by pigeek The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
CodyBarrett Posted January 23, 2009 Share Posted January 23, 2009 np its why we are here [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] 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