Regnbue Posted December 3, 2008 Share Posted December 3, 2008 You'll just get the source right away, question is right beneath it expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Lectio AutoLogin -> RTG", 356, 275, 270, 251) $Input1 = GUICtrlCreateInput("Brugernavn", 16, 24, 193, 21) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetTip(-1, "Brugernavn") $Input2 = GUICtrlCreateInput("Password", 16, 48, 193, 21) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetTip(-1, "Password") $Button1 = GUICtrlCreateButton("Save", 64, 72, 89, 25, 0) ; THIS IS WHERE MY PROBLEM IS ! . i think xD GUICtrlSetBkColor(-1, 0xA6CAF0) $Group1 = GUICtrlCreateGroup("Credits", 216, 8, 137, 89) $Label1 = GUICtrlCreateLabel("Name", 224, 32, 91, 17) $Label2 = GUICtrlCreateLabel("Some info", 224, 56, 58, 17) $Label3 = GUICtrlCreateLabel("Place", 288, 56, 54, 17) $Label4 = GUICtrlCreateLabel("Email", 224, 80, 126, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $MonthCal1 = GUICtrlCreateMonthCal("2008/12/03", 88, 104, 178, 169); Just so people can see what date it is x) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd $bPath = "C:\Program Files\Mozilla Firefox\firefox.exe" $Link="http://www.lectio.dk/lectio/523/default.aspx" Run($bPath & ' ' & $Link) WinWaitActive( "Lectio Roskilde" ) Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Sleep( 1000 ) Send("{ENTER}") Sleep( 5000 ) Send($Input1) Sleep( 1000 ) Send("{TAB}") Send($Input2) Sleep( 1000 ) Send("{ENTER}") Okay.. So What I'm trying to make, is an AutoLogin for my schools website.. Because I'm very tired of loggin in all the time with their weird passwords etc. So I made this GUI, which were ment to work like this: You launch it up ONCE. Then you enter your username and passwords, and press save. Now it should remember your password and username, untill you type in something new. How do i do that? Next on, I need to make the save button, a button. Right now, it just works as a clickable picture.. Doesn't do a thing. I need it to save the info, close down the GUI, and go launch the rest of the script. And if you find something that's wrong inside my script, please tell me, because I just started on autoit, and I'm really not that good at it x) I used Koda's GUI creator thingy Anyhow, if you want me to tell more, just say so, because I'd really like to make this Link to comment Share on other sites More sharing options...
rambo3889 Posted December 3, 2008 Share Posted December 3, 2008 Lectio 1) For making buttons do something there are two normal options : Either use the GUI messages that are captured by guigetmsg() or event. As i can see you've chosen to use the method guigetmsg. It is actually very simple just take the variable that you assign to the button save ( in this case $Button1) and create a new switch case statement: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 run("notepad.exe");Just to show you that the button now does something ;Save in whatever way you'll want to i.e ini's,registries or something else EndSwitch WEnd 2) For the saving part i would save the username and password to a file or something. You'll have to autoload these values when the script is run so that it uses the values from a previous save 3) When sending the data for your login you are actually sending the handle to the guicontrol send($input1), you previously assigned a guicontrol to input1 so you'll have to read what ever data that the desired input has. This can be done by using the function Guictrlread($input1) 4) Bare bliv ved med at prøv dig frem og det skal nok lykkedes ellers er forummet her et rigtigt godt sted at lære + hjælpefilen My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! Link to comment Share on other sites More sharing options...
enaiman Posted December 3, 2008 Share Posted December 3, 2008 rambo3889 did a very good thing and explained alot of things to you. I will ofer the solution I'm using streams to store your credentials - to see what I'm talking about: do a search on Examplwe Scripts for "ads" - and retrieve them. You will need to have 2 separate files: one to change your credentials and the other to do the job (autologin). save the following code in a file named L_Autologin.au3 #include <String.au3> $bPath = "C:\Program Files\Mozilla Firefox\firefox.exe" $Link="http://www.lectio.dk/lectio/523/default.aspx" Run($bPath & ' ' & $Link) WinWaitActive( "Lectio Roskilde" ) Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Sleep( 1000 ) Send("{ENTER}") Sleep( 5000 ) $username = _ADS(1, @ScriptDir&"\L_Autologin.exe", "username") Send($username) Sleep( 1000 ) Send("{TAB}") $password = _ADS(1, @ScriptDir&"\L_Autologin.exe", "password") Send($password) Sleep( 1000 ) Send("{ENTER}") Func _ADS($read, $file, $streamname, $write_msg = "", $encrypted = 0, $epassword = "", $encrypted_level = 1) If $read = 1 Then; Read $found = FileRead($file & ":" & $streamname) If $encrypted = 1 Then $found = _StringEncrypt(0, $found, $epassword, $encrypted_level) Return $found ElseIf $read = 0 Then; Write If $encrypted = 1 Then $write_msg = _StringEncrypt(1, $write_msg, $epassword, $encrypted_level) FileWrite($file & ":" & $streamname, $write_msg) EndIf EndFunc then compile this file and name it L_Autologin.exe Create a new file in the same folder as L_Autologin.exe and name it whatever you want (with au3 extension of course) - IT IS IMPORTANT that these 2 files to be in the same place. Save the following code in the new file and compile the file after that. Run it - enter your credentials and press "save" button. Close it after saving. Run L_Autologin.exe after that and it will do the job. expandcollapse popup#include <String.au3> #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Lectio AutoLogin -> RTG", 356, 280, 270, 251) $Input1 = GUICtrlCreateInput("Brugernavn", 16, 24, 193, 21) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetTip(-1, "Brugernavn") $Input2 = GUICtrlCreateInput("Password", 16, 48, 193, 21) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetTip(-1, "Password") $Button1 = GUICtrlCreateButton("Save", 64, 72, 89, 25, 0) ; THIS IS WHERE MY PROBLEM IS ! . i think xD GUICtrlSetBkColor(-1, 0xA6CAF0) $Group1 = GUICtrlCreateGroup("Credits", 216, 8, 137, 89) $Label1 = GUICtrlCreateLabel("Name", 224, 32, 91, 17) $Label2 = GUICtrlCreateLabel("Some info", 224, 56, 58, 17) $Label3 = GUICtrlCreateLabel("Place", 288, 56, 54, 17) $Label4 = GUICtrlCreateLabel("Email", 224, 80, 126, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $MonthCal1 = GUICtrlCreateMonthCal("2008/12/03", 88, 104, 178, 169); Just so people can see what date it is x) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 DllCall("kernel32.dll", "int", "DeleteFileW", "wstr", @ScriptDir&"\L_Autologin.exe:username") DllCall("kernel32.dll", "int", "DeleteFileW", "wstr", @ScriptDir&"\L_Autologin.exe:password") _ADS(0, @ScriptDir&"\L_Autologin.exe", "username", GUICtrlRead($Input1)) _ADS(0, @ScriptDir&"\L_Autologin.exe", "password", GUICtrlRead($Input2)) MsgBox(0, "Saved", "Login info saved.") EndSwitch WEnd Func _ADS($read, $file, $streamname, $write_msg = "", $encrypted = 0, $epassword = "", $encrypted_level = 1) If $read = 1 Then; Read $found = FileRead($file & ":" & $streamname) If $encrypted = 1 Then $found = _StringEncrypt(0, $found, $epassword, $encrypted_level) Return $found ElseIf $read = 0 Then; Write If $encrypted = 1 Then $write_msg = _StringEncrypt(1, $write_msg, $epassword, $encrypted_level) FileWrite($file & ":" & $streamname, $write_msg) EndIf EndFunc Credits to Firestorm for this function. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Regnbue Posted December 4, 2008 Author Share Posted December 4, 2008 Thanks alot for your help. Going to try this later today, since I'm late for school at the moment! Will return with results (and proberbly more questions xD) Link to comment Share on other sites More sharing options...
Regnbue Posted December 4, 2008 Author Share Posted December 4, 2008 Thanks, it works totally as intended ! Just one more thing. In the GUI, can I get it to hide the password? Like when you type, it replaces everything with Asteriks' ? (*) Link to comment Share on other sites More sharing options...
rambo3889 Posted December 4, 2008 Share Posted December 4, 2008 Use $ES_PASSWORD as the style for the input My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! 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