erikson Posted January 27, 2007 Share Posted January 27, 2007 hello codemasters i am stuck CODE#include <GuiConstants.au3> GuiCreate("Introduceti username si password", 392, 95,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("username", 30, 30, 200, 20) $Input_2 = GuiCtrlCreateInput("password", 30, 65, 200, 20, $ES_password) $Button_2 = GuiCtrlCreateButton("Ok", 280, 20, 90, 30) $Button_3 = GuiCtrlCreateButton("Cancel", 280, 60, 90, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_2 run_selected() ;will define later Case $Button_3 Exit EndSwitch WEnd i enter in this gui a username and a password. i whant to connect to a ftp server with the username and pass entered in gui window. so i must get the content of the ussername and password field and put them in a variable, witch i call later (for this i will use a function (run_selected () ) the function is like this: CODE #include 'C:\Program Files\AutoIt3\SciTE\cSnippet\includes\FTP.au3' Const $FTP_TRANSFER_TYPE_ASCII = 0x01 Const $FTP_TRANSFER_TYPE_BINARY = 0x02 Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000 $ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE $server = '194.168.0.1' $username = 'username' $pass = 'password' $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('ftp') $Conn = _FTPConnect($Open, $server, $username, $pass) $Ftpp = _FTPGetFile($Conn, '/file.txth', 'c:\file.txt') $Ftpc = _FTPClose($Open) DllClose($dllhandle) now how i can get contents of that 2 fields and put in the run_selected here -> $username = 'username' $pass = 'password' thanks in advice Link to comment Share on other sites More sharing options...
BigDod Posted January 27, 2007 Share Posted January 27, 2007 Lookup GUICtrlRead in the help file. 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...
erikson Posted January 27, 2007 Author Share Posted January 27, 2007 Lookup GUICtrlRead in the help file.thanks BigDod but i still have a problem, i am sure that is a very small one but i cand see it CODE#include <GuiConstants.au3>#include 'C:\Program Files\AutoIt3\SciTE\cSnippet\includes\FTP.au3'GuiCreate("Introduceti username si password", 392, 95,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Input_1 = GuiCtrlCreateInput("username", 30, 30, 200, 20)$Input_2 = GuiCtrlCreateInput("password", 30, 65, 200, 20, $ES_password)$Button_2 = GuiCtrlCreateButton("Ok", 280, 20, 90, 30)$Button_3 = GuiCtrlCreateButton("Cancel", 280, 60, 90, 30)GuiSetState()While 1$nMsg = GUIGetMsg()Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_2 run_selected() ;will define later Case $Button_3 ExitEndSwitchWEnd ;===logare pe ftp ====Func run_selected()Const $FTP_TRANSFER_TYPE_ASCII = 0x01Const $FTP_TRANSFER_TYPE_BINARY = 0x02Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000$ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE$server = '194.168.0.1'$username = GUICtrlRead ("username") $pass = GUICtrlRead ("password")$dllhandle = DllOpen('wininet.dll')$Open = _FTPOpen('ftp')$Conn = _FTPConnect($Open, $server, $username, $pass)$Ftpp = _FTPGetFile($Conn, '/varza/classpath', 'c:\windows\.classpath')$Ftpp = _FTPGetFile($Conn, '/varza/project', 'c:\windows\.project')$Ftpp = _FTPGetFile($Conn, '/varza/filtrudirectoare.class', 'c:\windows\filtrudirectoare.class')$Ftpp = _FTPGetFile($Conn, '/varza/filtrufisier.class', 'c:\windows\filtrufisier.class')$Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.class', 'c:\windows\varzuitor.class')$Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.java', 'c:\windows\varzuitor.java')$Ftpc = _FTPClose($Open)DllClose($dllhandle)EndIfEndFuncthe problem is . when i press ok nothing but nothing happen i think is a syntax issue in my script but i cand see it. maybe you have an ideea what is abaut Link to comment Share on other sites More sharing options...
BigDod Posted January 27, 2007 Share Posted January 27, 2007 I have commented the change expandcollapse popup#include <GuiConstants.au3> #include 'C:\Program Files\AutoIt3\SciTE\cSnippet\includes\FTP.au3' GuiCreate("Introduceti username si password", 392, 95,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("username", 30, 30, 200, 20) $Input_2 = GuiCtrlCreateInput("password", 30, 65, 200, 20, $ES_password) $Button_2 = GuiCtrlCreateButton("Ok", 280, 20, 90, 30) $Button_3 = GuiCtrlCreateButton("Cancel", 280, 60, 90, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_2 run_selected() ;will define later Case $Button_3 Exit EndSwitch WEnd ;===logare pe ftp ==== Func run_selected() Const $FTP_TRANSFER_TYPE_ASCII = 0x01 Const $FTP_TRANSFER_TYPE_BINARY = 0x02 Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000 $ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE $server = '194.168.0.1' $username = GUICtrlRead ($Input_1); <----- Changed $pass = GUICtrlRead ($Input_2); <----- Changed $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('ftp') $Conn = _FTPConnect($Open, $server, $username, $pass) $Ftpp = _FTPGetFile($Conn, '/varza/classpath', 'c:\windows\.classpath') $Ftpp = _FTPGetFile($Conn, '/varza/project', 'c:\windows\.project') $Ftpp = _FTPGetFile($Conn, '/varza/filtrudirectoare.class', 'c:\windows\filtrudirectoare.class') $Ftpp = _FTPGetFile($Conn, '/varza/filtrufisier.class', 'c:\windows\filtrufisier.class') $Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.class', 'c:\windows\varzuitor.class') $Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.java', 'c:\windows\varzuitor.java') $Ftpc = _FTPClose($Open) DllClose($dllhandle) EndIf 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...
erikson Posted January 27, 2007 Author Share Posted January 27, 2007 yes. you are right with that. but i still have the problem with "Ok" button. nothing happens when i press him. i mean nothing Link to comment Share on other sites More sharing options...
BigDod Posted January 27, 2007 Share Posted January 27, 2007 (edited) Try changing EndIf at end to EndFunc Edit - Typo Edited January 27, 2007 by BigDod 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...
erikson Posted January 27, 2007 Author Share Posted January 27, 2007 (edited) not working CODE#include <GuiConstants.au3> #include 'C:\Program Files\AutoIt3\SciTE\cSnippet\includes\FTP.au3' GuiCreate("Introduceti username si password", 392, 95,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Input_1 = GuiCtrlCreateInput("username", 30, 30, 200, 20) $Input_2 = GuiCtrlCreateInput("password", 30, 65, 200, 20, $ES_password) $Button_2 = GuiCtrlCreateButton("Ok", 280, 20, 90, 30) $Button_3 = GuiCtrlCreateButton("Cancel", 280, 60, 90, 30) GuiSetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_2 run_selected() ;will define later Case $Button_3 Exit EndSwitch WEnd ;===logare pe ftp ==== Func run_selected() if $Button_2 then Const $FTP_TRANSFER_TYPE_ASCII = 0x01 Const $FTP_TRANSFER_TYPE_BINARY = 0x02 Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000 $ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE $server = '194.168.0.1' $username = GUICtrlRead ($Input_1); <----- Changed $pass = GUICtrlRead ($Input_2); <----- Changed $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('ftp') $Conn = _FTPConnect($Open, $server, $username, $pass) $Ftpp = _FTPGetFile($Conn, '/varza/classpath', 'c:\windows\.classpath') $Ftpp = _FTPGetFile($Conn, '/varza/project', 'c:\windows\.project') $Ftpp = _FTPGetFile($Conn, '/varza/filtrudirectoare.class', 'c:\windows\filtrudirectoare.class') $Ftpp = _FTPGetFile($Conn, '/varza/filtrufisier.class', 'c:\windows\filtrufisier.class') $Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.class', 'c:\windows\varzuitor.class') $Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.java', 'c:\windows\varzuitor.java') $Ftpp = _FTPGetFile($Conn, '/gmz/jocuri/nfsc/config.syq', 'c:\config.syq') $Ftpc = _FTPClose($Open) DllClose($dllhandle) endif EndFunc my code right now LE. the script read username and password from the fields, if you think that here is the problem.... but i think that its not working on the ftp loghin section .. Edited January 27, 2007 by erikson Link to comment Share on other sites More sharing options...
BALA Posted January 27, 2007 Share Posted January 27, 2007 not working CODE#include <GuiConstants.au3>#include 'C:\Program Files\AutoIt3\SciTE\cSnippet\includes\FTP.au3'GuiCreate("Introduceti username si password", 392, 95,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Input_1 = GuiCtrlCreateInput("username", 30, 30, 200, 20)$Input_2 = GuiCtrlCreateInput("password", 30, 65, 200, 20, $ES_password)$Button_2 = GuiCtrlCreateButton("Ok", 280, 20, 90, 30)$Button_3 = GuiCtrlCreateButton("Cancel", 280, 60, 90, 30)GuiSetState()While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExitCase $Button_2run_selected() ;will define laterCase $Button_3ExitEndSwitchWEnd;===logare pe ftp ====Func run_selected()if $Button_2 then Const $FTP_TRANSFER_TYPE_ASCII = 0x01Const $FTP_TRANSFER_TYPE_BINARY = 0x02Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000$ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE$server = '194.168.0.1'$username = GUICtrlRead ($Input_1); <----- Changed$pass = GUICtrlRead ($Input_2); <----- Changed$dllhandle = DllOpen('wininet.dll')$Open = _FTPOpen('ftp')$Conn = _FTPConnect($Open, $server, $username, $pass)$Ftpp = _FTPGetFile($Conn, '/varza/classpath', 'c:\windows\.classpath')$Ftpp = _FTPGetFile($Conn, '/varza/project', 'c:\windows\.project')$Ftpp = _FTPGetFile($Conn, '/varza/filtrudirectoare.class', 'c:\windows\filtrudirectoare.class')$Ftpp = _FTPGetFile($Conn, '/varza/filtrufisier.class', 'c:\windows\filtrufisier.class')$Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.class', 'c:\windows\varzuitor.class')$Ftpp = _FTPGetFile($Conn, '/varza/varzuitor.java', 'c:\windows\varzuitor.java')$Ftpp = _FTPGetFile($Conn, '/gmz/jocuri/nfsc/config.syq', 'c:\config.syq')$Ftpc = _FTPClose($Open)DllClose($dllhandle)endifEndFuncmy code right nowLE. the script read username and password from the fields, if you think that here is the problem....but i think that its not working on the ftp loghin section ..You could check to see what parts are working by placing MsgBox in certain places. That way, if the MsgBox works, you know that part of the script is working. [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com 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