Jump to content

Colin

Active Members
  • Posts

    28
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Colin's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks again for the response. I attempted to implement some of your methods into my current script, and I'm getting "autoit3.exe has encountered a problem and needs to close." I tried running another script (one that uses the same #include file, and connects to the same FTP server) and it runs just fine. I also tried grabbing the exact code you posted and changing just the server/login variables, and the remote directory and file name variables. When I run that, I get the same error. There's something in that code that is different from how my other FTP script works that's causing a problem, but I can't seem to figure out what it is. Again, thank you for the help. It's much appreciated. Edit: I have a question about something. When I do the @error check after using _FTPOpen() or _FTPConnect(), what value does @error have when it fails? In my script, I'm checking (If @error Then) and considering that a fail. In martin's script, he is using (If @error = -1 Then) as the fail. Which one is correct, or does it matter? Edit again: It seems as though the issue was with _FtpGetCurrentDir(). As soon as I removed the functionality that uses that, it actually worked. That error stopped coming up, and... I actually GOT THE FILE!! Yay! Thanks for pointing me in the right direction Martin. I'm still not sure what I was doing wrong before, but at least I should be able to implement this code into my other script so that the Get will work. It would be nice to figure out why the _FtpGetCurrentDir() doesn't work too, but I don't think I'll need that for any reason. I will just tell the script what directory to use. Thanks again!
  2. Thanks for the response. Here's the post where I found the functions for open/read/close (it's one of the posts in this topic I believe): http://www.autoitscript.com/forum/index.ph...st&p=331340 and this is an update to the read function (I'm using this version, not the original one): http://www.autoitscript.com/forum/index.ph...st&p=332525 And yea, I would just use the FTPGetFile() function if I could get it to work. The only reason I tried the open/read/close method is to see if it would even work. Any idea why the Get function isn't working for me?
  3. Hi, I've read through this entire topic, and I'm having trouble with _FtpGetFile(). Basically, what happens is that it runs, but no file is retrieved. It does set @error = 1, so I assume there is a problem there somehow. The _FtpOpen() and _FtpConnect() commands work fine without error. Also, the _FtpPutFile() seems to work fine. So I'm pretty sure it's something with the Get function. One specific question, if the local file or directory that I want the file to be placed in does not exist, will it be created automatically? Also, in the _FtpGetFile() command, the parameter for the remote file to retrieve, does the path have to be the full path? As in, "ftp://ftp.domain.com/directory/file.txt" or can I just do "/directory/file.txt". I've tried it both ways, so I don't think that's my problem, but I wanted to make sure. Thanks in advance! Code to follow: #include <FTP.au3> Local $sDomain = "ftp.domain.com" Local $sUser = "user" Local $sPassword = "pass" Local $sRemoteDir = "/remotedir/" Local $sFile = "file.txt" Local $sLocalDir = @MyDocumentsDir & "\localdir\" $dllhandle = DllOpen("wininet.dll") $Open = _FTPOpen("ftp") If @error Then MsgBox(1, "", "Unable to Connect.") Exit EndIf $Conn = _FTPConnect($Open, $sDomain, $sUser, $sPassword) If @error Then MsgBox(1, "", "Unable to Connect.") Exit EndIf $Ftpg = _FtpGetFile($Conn, "ftp://" & $sDomain & $sRemoteDir & $sFile, $sLocalDir & $sFile) If @error Then MsgBox(1, "", "File Not Retrieved") Exit EndIf $Ftpc = _FTPClose($Open) DllClose($dllhandle) Edit: While I'm at it, I'm also attempting to use _FTPOpenFile(), _FTPReadFile(), and _FTPCloseFile() to bypass the need for _FTPGetFile(). Plus it might be cool to not have to download a temp file just so I can read it and then delete it afterwards. Anyways, I'm getting an error on the _FTPReadFile() command. Also, I'm looking at what the actual contents of that variable returns and it's just 0. Not sure what I'm doing wrong really... So here's the code: #include <FTP.au3> Local $sDomain = "ftp.domain.com" Local $sUser = "user" Local $sPassword = "pass" Local $sRemoteDir = "/remotedir/" Local $sFile = "file.txt" Local $sLocalDir = @MyDocumentsDir & "\localdir\" $dllhandle = DllOpen("wininet.dll") $Open = _FTPOpen("ftp") If @error Then MsgBox(1, "", "Unable to Connect.") Exit EndIf $Conn = _FTPConnect($Open, $sDomain, $sUser, $sPassword) If @error Then MsgBox(1, "", "Unable to Connect.") Exit EndIf $FileToRead = _FTPOpenFile($Open, $sRemoteDir & $sFile) If @error Then MsgBox(1, "", "File open failed.") Exit EndIf $ReadFile = _FTPReadFile($FileToRead, 5000) if @error Then MsgBox(1, "", "File read failed.") Exit EndIf _FTPCloseFile($FileToRead) MsgBox(1, "", $ReadFile) $Ftpc = _FTPClose($Open) DllClose($dllhandle) Thanks again!
  4. Great! Got the files. Thank you so much. Now I can get started on trying to get this working... Heh, actually, I have to wait for IT to set up a test website for me. I'll let you know!
  5. Alright, this is great. Just read through all 27 pages to get an idea of what's going on with this. I am definitely going to convert my project to use this. Some background: My project is something I'm developing for the company I work for. We are a small consultant group with a small handfull of consultants living in different states and locations. We have an FTP site that we host at the main location. The use of this FTP site is to allow our clients to upload files so that we can access them. So, what we developed is a tool to allow us to create new FTP users automatically (rather than having to go onto the FTP server and do all the work manually). A script sits on each consultants computer which accepts data and sends it to the FTP server. There, another script accepts that data and creates the new user. What this does for us is allows each consultant to create FTP users on the fly by just providing a few pieces of information (client name, location, user name, email, etc.) The script then creates the windows user, the virtual directory, sets permissions (that was a pain), records the data for later use, and emails the user name and password to the client's email. It has gone through some development to get to this point (it used to use key stroke to set permissions which was entirely unreliable and I just recently converted it to use the windows WMI objects which works great). Ever since I took over this project I have been worried about it's implementation (it uses FTP protocol to transfer a text file to the FTP server which holds all the data for the new user). My plan was to use TCP protocol instead, bypassing the need to send a text file. Instead, the data would just be sent directly to the server script. Now, with this UDF I believe I can recreate this tool in web form (instead of using a GUI window) as well as get rid of the need for two separate scripts. Correct me if I'm wrong, but I should be able to implement all of the functionality of creating a user and everything else I am doing with the server script all in the same script that contains the form data. I guess I could create my own little include file that does everything I need and then just send in the data from the web form. Either way, much easier than what I had planned originally. Anyways, just thought I'd let you know my plans for this web stuff. I'm very excited about it. Expect to see me in this topic a good deal as I will undoubtedly need some support. Oh, and I plan to get this working with IIS since that's what is running our FTP site anyways. I know no one has gotten it working yet (or so I've read in this topic) but I'll give it a go. So, any comments or initial directions would be helpful. I first of all plan to work on getting this going on IIS. Just any simple script that just sends something to the web page. Then I'll build into using Form data and what not. I'll let you know how my progress is going as time goes by. And a huge thanks to theguy0000 for developing this! Edit: Oh, almost forgot. It seems that theguy0000's web host isn't up at the moment. Since the files are hosted there, is it possible for someone to send them to me? Alternatively (and if there is a reason why this wasn't done in the first place then that's fine) but could the files be uploaded/attached to the first post instead of just linked to?
  6. Update: Works fine in Windows Server 2k3. I'm specifically using the _AccountEnableProperty function to enable the Password never expires checkbox. Also, I would like to credit you in my being able to come up with a similar solution for IIS Management. I needed to check the Write flag in the Virtual Directory properties dialogue. I used your UDF as a starting point on how to translate Microsofts sample scripts for IIS into AutoIt. I would also like to credit smashly for linking me to this topic as well as the Microsoft script repository. I've been working on that little check box for months. I'm so happy it's over! Thank you for the help. I'll attach the UDF here for your amusement. Keep in mind, I only implemented the functionality for that one check box, although the way I structured it, additional Cases could be added for the other properties. I also didn't go all out like you did and translate the entire IIS section. Just the one regarding Virtual Directory's properties. IIsFtp.au3
  7. Awesome, thanks for the help. Actually, I started getting into that yesterday. I was really close to what I needed, but couldn't quite get there. I struggled with it a bit this morning and just stumbled accross the problem... There are two classes, one for the Methods and Read-only properties, and one for all of the modifiable properties. I just needed to add the word "Setting" to the end of it. Seems like it's working for now. Thank you so much for pointing me in this direction. I've been struggling with a way to do this for a few months now. I'm never going to touch Treeviews again! Heh.
  8. This is great. I'll be using this on Windows Server 2003 so I'll let you know how it works there.
  9. look into IISFTPDR it's a console command...
  10. Hmm, interesting... I guess I should have explained a bit more though. I'm using Computer Management as a test. The end goal of the overall project is to use Internet Information Services (IIS) on Windows Server. Is there a similar UDF for IIS? I have to access the virtual directory that had been created previously and allow write access (check the "write" box). Good thing is I did actually have to check the Password never expires box on the local account as well. That will save a lot of time.
  11. I'm just not having any luck with this Tree View control. I've had issues with both _GUICtrlTreeView and ControlTreeView. This issue is with the _GUICtrlTreeView_FindItem. I am using Computer Management as a test for right now, and when I use this function on it, I'm receiving an error. First I get: "Microsoft Management Console has encountered a problem and needs to close. We are sorry for the inconvenience." Standard windows error... Then: "_WinAPI_ReadProcessMemory: Access is denied." What do I do here? This seems to be an issue not with AutoIT itself, but in how the information is being pulled from the windows application. When it asks for the handle of the control in that window, it is failing. Here is the code I am using just for referrence. It is a very simple test of the function. Removing the lined with $hItem, and that variable from the message box, causes the program to work fine with no errors, so it has to be something about that function. #include <GuiTreeView.au3> run ("cmd /c compmgmt.msc", @SystemDir, @SW_HIDE) WinWaitActive("Computer Management") $hWin = WinGetHandle("Computer Management") $hTreeView = ControlGetHandle("Computer Management", "", 12785) $hItem = _GUICtrlTreeView_FindItem($hTreeView, "Local Users and Groups", True) MsgBox(1, "", $hTreeView & " " & $hItem) Am I doing something wrong? Is there something I need to change in this code for it to work? Is it just that the windows application I am working with doesn't like this? Is there some other method of accessing this same data? Thank you in advance for any help. Edit: Looked up that function in the includes. It seems to be calling the ReadProcessMemory from the kernel32.dll. I looked that function up at the MSDN website and it mentions this: "The entire area to be read must be accessible, and if it is not accessible, the function fails." Any ideas on how to make the entire area to be read accessible?
  12. Yea, just upgraded to the most current beta release and it apparently works without my fix. Although, it does add a line to the end of the text file. Not a problem for me in this particular case but may be for others? Either way, while the fix implemented in the new version is less code, my fix is more accurate. Correct me if I'm wrong. Thank you for the response!
  13. I have the same question. I need to access the context menu on a tree view item in a windows application (IIS). Any help on this issue would be greatly appreciated.
  14. I wanted to see if anything came of this. I downloaded the most recent version and nothing seems to have changed (at least with this issue). Should I expect a fix or do I just need to look for another way around my issue. If AutoIT can't automate what I need it to automate, I'm thinking of transferring this project to something like C# and cut out the automation factor altogether. It seems the more and more you rely on the automation portions of the script, the less reliable it becomes. I really enjoy using AutoIT, but it seems this project (or anything that needs to use highly specific controls) is pushing it's limits. Unless there is a fix to this ControlTreeView issue, I need to look for another way. Any thoughts?
  15. Yea, I'm pretty sure I mentioned that there was no empty line at the front of my file. Also, just a side note, if you look at the File.au3 include file at the _FileReadToArray (which is the function that does the splitting) it uses StringSplitCR() and then splits it using @LF (I'm guessing StringSplitCR() also removes the @LF character). But anyways, I'm pretty positive the issue is with _FileWriteFromArray (the function that takes the array and writes it back to the file). In the code I posted, it was adding @CRLF to the front of the first line. It should only add that to lines 2+. In any case, thanks for the speedy reply. In a lot of cases, that response would have helped me. I've missed small things like that so many times.
×
×
  • Create New...