Cruz Posted September 22, 2005 Share Posted September 22, 2005 I am using the Send() command to send a password to another program but if the $password variable contains anything other than just alphanumeric characters (i.e. PaSSword!, PA55word#) the special characters are dropped when I use the variable.$password = GUICtrlCreateInput("",80,60,150,20,).........Send(GUICtrlRead($password))Is there a better way of doing this?? Link to comment Share on other sites More sharing options...
Valuater Posted September 22, 2005 Share Posted September 22, 2005 (edited) YESSSS !!!!!!!!!!!!!I got itexpandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> #include <Array.au3> ;Dim $array GUICreate(" My GUI input acceptfile", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateLabel ( "Please type in your password", 10, 5, 300, 20) $passwd = GUICtrlCreateInput ("", 10, 35, 300, 20); will not accept drag&drop files $btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20) GUICtrlSetState(-1,$GUI_DEFBUTTON) $btn2 = GUICtrlCreateButton ("Exit", 200, 75, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn2 Exit Case $msg = $btn Call("Set_passwd") EndSelect Wend Func Set_passwd() ; for testing Run("notepad.exe") WinWaitActive("") Sleep(1000) $pass = GUICtrlRead($passwd) $array = StringSplit($pass,"") ;_ArrayDisplay($array) For $x = 1 to $array[0] ;MsgBox(0,"test", $array[$x],1) if $array[$x] >= Chr(48) And $array[$x] <= Chr(57) Or $array[$x] >= Chr(65) And $array[$x] <= Chr(90) Or $array[$x] >= Chr(97) And $array[$x] <= Chr(122) Then Send($array[$x]) if $array[$x] = " " Then Send(Chr(32),1) if $array[$x] = "!" Then Send(Chr(33),1) if $array[$x] = '"' Then Send(Chr(34),1) if $array[$x] = "#" Then Send(Chr(35),1) if $array[$x] = "$" Then Send(Chr(36),1) ; until you get all you want Next EndFuncKept trying and whala...Yes.... Yes... Yes......8) Edited September 22, 2005 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted September 22, 2005 Share Posted September 22, 2005 BUMPER... 8) Link to comment Share on other sites More sharing options...
r4v3n Posted September 22, 2005 Share Posted September 22, 2005 I am using the Send() command to send a password to another program but if the $password variable contains anything other than just alphanumeric characters (i.e. PaSSword!, PA55word#) the special characters are dropped when I use the variable.$password = GUICtrlCreateInput("",80,60,150,20,).........Send(GUICtrlRead($password))Is there a better way of doing this?? Link to comment Share on other sites More sharing options...
BigDod Posted September 22, 2005 Share Posted September 22, 2005 @r4v3n Did you forget to type something (ie a question or comment) Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Cruz Posted September 27, 2005 Author Share Posted September 27, 2005 Thanks for your help Valuater!! Link to comment Share on other sites More sharing options...
w0uter Posted September 27, 2005 Share Posted September 27, 2005 Call("Set_passwd")for gods sake not you too why do you guys keep using call ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted September 27, 2005 Share Posted September 27, 2005 (edited) What about sending the variable as raw keys? That way special keys aren't interpreted as shifts and what not? That and ControlSend is a much safer alternative for sending keystrokes to an application...test.au3 Edited September 27, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 for gods sake not you too why do you guys keep using call ?You mentioned this before and i didn't reply... sothis is the use (as i understand) of Call()Create GUI Create $button set state While $m = get message if $m = $button then Call("my_function") wend Func my_function message box endfuncisn't this a correct use of Call()????8) Link to comment Share on other sites More sharing options...
Buffo Posted September 28, 2005 Share Posted September 28, 2005 Yes, it's correct, but it isn't needed. There are two pissibilities to call a function: 1. Call("FuncName") 2. FuncName() With the second command you can send additional parameters to the function. It's the standard format. For example: ShowMyName("Buffo") Func ShowMyName($name) MsgBox(0, "Your name is", $name) EndFunc Cu, Buffo Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 Yes, it's correct, but it isn't needed.Buffothx8) Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2005 Share Posted September 28, 2005 Yes, it's correct...That is a matter of some debate. Just take a look at a few opinions:http://www.autoitscript.com/forum/index.ph...lite=call%28%29...two pissibilities...Great typo!Some would say that if FuncName() will work and you use Call(), you are wrong.I do not really care - I just could not pass up posting about the "pissibilities"..............later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 Plato PM'ed me with a question about just using Send(GUICtrlRead($passwd), 1) and yes...... it worked #include <GUIConstants.au3> GUICreate(" My GUI input acceptfile", 320,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES $file = GUICtrlCreateLabel ( "Please type in your password", 10, 5, 300, 20) $passwd = GUICtrlCreateInput ("", 10, 35, 300, 20); will not accept drag&drop files $btn = GUICtrlCreateButton ("Ok", 40, 75, 60, 20) GUICtrlSetState(-1,$GUI_DEFBUTTON) $btn2 = GUICtrlCreateButton ("Exit", 200, 75, 60, 20) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn2 Exit Case $msg = $btn Send(GUICtrlRead($passwd), 1) EndSelect Wend to call or not to call was not the question (plato) thx 8) Link to comment Share on other sites More sharing options...
Encryption Posted September 28, 2005 Share Posted September 28, 2005 As for call...it really is pointless. I mean a function to call another function? Yeah... Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 Which function is calling what function... i don't see it here in any of these posts????? 8) Link to comment Share on other sites More sharing options...
MrSpacely Posted September 28, 2005 Share Posted September 28, 2005 Call("Set_passwd")if $m = $button then Call("my_function")Well, Call is useless here its not batchfileIf you would you also would need to call call and call that alsolike call("call(""call(""""call(""""""infiniti"""""")""""")"")Explain why please Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 (edited) Well, Call is useless here its not batchfileIf you would you also would need to call call and call that alsolike call("call(""call(""""call(""""""infiniti"""""")""""")"")Explain why please neither of those were inside of a functionthey were inside a while/wend loopand according to the help file For $i = 1 to 2 $ret = Call("test" & $i) MsgBox(4096,"", $ret) Next Func test1() Return "Hello" EndFunc Func test2() Return "Bye" EndFuncthe function Call() is utilized within a loop..... and utilizes two different functions8) Edited September 28, 2005 by Valuater Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted September 28, 2005 Share Posted September 28, 2005 I only ever use call if I would want a user to execute a certain function... Say I make a Gui with a bunch of labels and an input box let him type it in exactly, then it just calls it. That's still not the easiest way to do it...but don't forget, params for functions must have defaults, or I'm pretty sure it will error. It took me forever to remember that when I had a COM Error function...what a nightmare that was...interfacing an error function with a com object and a normal function... Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2005 Share Posted September 28, 2005 Like MSLx, I thought that "to call or not to call" was based on needing a variable as the (or part of the) function name. See this post that caused Call() to be added to AutoIt3: http://www.autoitscript.com/forum/index.ph...338&st=0&p=1626Thanks Valuater for testing/posting.I was too tired to test what MSLx tried to inject in post #8:"What about sending the variable as raw keys? That way special keys aren't interpreted as shifts and what not?"and perhaps Cruz should heed the other suggestion in that post:"That and ControlSend is a much safer alternative for sending keystrokes to an application..."later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Cruz Posted September 29, 2005 Author Share Posted September 29, 2005 "What about sending the variable as raw keys? That way special keys aren't interpreted as shifts and what not?"and perhaps Cruz should heed the other suggestion in that post:"That and ControlSend is a much safer alternative for sending keystrokes to an application..."The Send(GUICtrlRead($variable),1) command with raw keys option worked. A couple of my users had special characters in their passwords and this command worked perfecty.Thanks for the help guys, I am really learning from reading this forum.-Cruz 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