Jump to content

GIS007

Active Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by GIS007

  1. Testing this is difficult because once it fails, the subsequent times it runs successfully, so am really only able to test once per day. Today my IT guy said this script paused at line 19. It has been running correctly for the past week, the only difference is yesterday a user opened the program and pointed it to a different folder (program defaults to the last path that was used, even if the pbt file wasn't there). I'm still working on the error checking - bear with me. Is there a better way to initiate the Browse window to actually find the L drive other than using ControlClick? In case another user opens their program and browses to a different location?
  2. Okay, I will try to rewrite my script using your suggestions. Thank you! The reason that I keep going back to using Send is because the keystrokes to get this file menu item are so easy - here is what the GUI looks like (attached image). Any time I try to use ControlSend or WinMenuSelectItem it fails.
  3. Using the function help page (which has examples that are of limited use), my WinMenuSelectItem line doesn't work: WinMenuSelectItem("Annotate","Shapefile/DBF Maintenance","") Why does everyone seem to dislike using the Send command? I can see if the keystrokes were complicated it could pose problems but here it seems pretty straightforward? And, I had the same issue with ControlSend not working where just sticking in a 'send' line did work: ControlSend("Open", "File name", 32770, "PdxBatch09122012.pbt")
  4. I am trying to learn how to write to a file for error checking, etc. I wish I had jdelaney's brain! But I'm really new to AutoIT & my supervisor passed along a script from someone in another county that supposedly works fine for them - it's only 16 lines of code with no error checking, no if/thens, etc & my supervisor is looking at me saying 'why does his work & yours still doesn't when his is so much shorter than yours?' He thinks I am making this too complicated.... I will definitely incorporate jdelaney's suggestions into my script as soon as I can get them to work out. It's just so illogical to me that the script will run a second time but not the first.
  5. Ok, will try that. I am still having that issue where the program runs fine the second time. I was thinking that it was a network connection being dropped so I have tried ping to refresh the connection (didn't work), so I thought if I had the script go out on the network & check to see if the file existed, it would refresh the connection so the script would run on the first time. Something must be going on somewhere else to cause this?
  6. Here's my updated script. I am still working on being able to use logging and ControlSend vs Send so unfortunately those changes haven't been incorporated yet. I added line 5 - checking to see if the file exists. When I ran this today it paused after line 13. Any idea why? Thanks for any further help!
  7. Okay, will do. Man I was hoping that the ping would fix this.
  8. Well, someone gave me the idea that network connections can be dropped, especially since there are all these jobs that run at night, so if I did a ping statement (well actually they told me to refresh the network connections. But I'm very new to AutoIT so I try to stick with the stuff I know) it would 'wake up' that network connection. I was going on the assumption that running the exe the first time & it returns only a part of the name is because the connection wasn't refreshed in time? And, no kylomas, the file name that is returned in the error message is not always the same, it drops various amounts of the name.... Is that significant? My boss unfortunately was too busy to test this today but I'll check w/him next week & see if that works. And, good suggestion Tripredacus about the potential issue w/firewall changes, I'll keep that in mind. Awesome group of people here!
  9. What about just using ping? It appears that the connection to the network drive is getting dropped, perhaps that is why the first attempt fails but the second one, which hits the network after the connection has been refreshed, works? So, if I just ping that server won't that refresh the connection? I inserted a "ping( <network IP>)" statement and ran it, & it appears to work, but won't be able to say for sure until the jobs run tonight. Am I on the right track at all?
  10. Thanks for the input.1-My boss wants this to run as a scheduled job so I felt an exe would be the best thing to deliver to him. 2-No, Change Analysis is strictly all GUI. 3-Yes it is the only file w/that extension. I'll try your suggestion. I have been randomly asking people about this issue & someone suggested that the connection to the network drive is being lost, which is why the program has to run twice - the first attempt will re-establish the connection. He said to use a Refresh command to get the network connection re-established, but I don't see anything like this in AutoIT. Any ideas? Thanks!
  11. I'm getting pulled off this project so another programmer can look at it. I still do want to try to fix this, so I can learn it myself as opposed to letting this senior person take it and run with it. Thanks for all your help.
  12. Thanks for your input. Here's what I'm trying to do: Open Change Analysis.Browse to the menu item named "Annotate."Select the "Shapefile/DBF Maintenance" submenu. The next step is to process the files (I'm sorry I don't really know much about what that does, it might be building some kind of index since these files get re-written every night).Then I need to click the browse button. The program defaults to the last place that the files were processed from. It is on the L drive which from what I can figure out, this is a virtual drive, I think the actual folder resides on one server but when the L drive was mapped it was mapped to another server. I can't get anyone to really drill down & explain the nuts & bolts to me but I believe the actual folder is on a different box, and the L drive is mapped to a 2nd server. Don't know if that is significant or not.I have to select the pbt file which is some kind of batch file that was created by the person who set up the program. Apparently it gets changed from time to time but the last time it was modified was 2012.Once the pbt file is selected, have to click the "Run" icon & it 'processes' these files, which takes about 25 minutes.Then the window closes & the main program window is ready.It consistently bails out the first time it's run but if I (or my boss) just go right ahead & click it again, it works without a hitch. He wants to put this on a schedule so that it runs at night. Should I just suggest to him to schedule it twice? (I realize that is probably hilariously stupid to suggest but sometimes stupid works, right?) Thanks in advance!
  13. Well, when I run that from the cmd line, I get a message saying L:\PdxBatch09122012.pbt was not found. Is that because I am using the mapped drive?
  14. So, I should put a sleep statement before the Shapefile/DBF Maintenance window is opened?
  15. Ok, I am trying JDelaney's suggestion about the handles - however I think error trapping & log writing is beyond me at this point. Can you please elaborate a bit on your final post here? And remember I am a real newbie so if you could dumb it down quite a bit, I would appreciate it. This little exe is supposed to open the program & do everything for the user, so they should not be clicking on anything & trying to open or use any windows until it's finished. Thank you again!
  16. Wow, ok, thanks jdelaney! Guess I still have a lot to learn about AutoIT syntax. I'll take your example - thanks so much for that - & try to duplicate that. Thank you!
  17. Hello All- I am new to AutoIT, this is my first script. It is supposed to open a program, get a menu option, then open a file on the network. I was able to get it to run however now that the exe is out on the network, when my boss opens it the first time it runs successfully until it reaches the part where it’s supposed to browse out & grab the file. Then it returns an error that the file is not present & it leaves off the first several letters of the file name (should be “PdxBatch09122012.pbt” – see screenshot, it leaves off the beginning & calls it “09122012.pbt"). The weird thing is, when he re-runs the script it finishes successfully. Can anyone help me out with the cause of this weird behavior? As long as he runs the script twice it performs as it should. Here is my code for the tool: ; This tool will open Change Analysis, & run the shapefile ; maintenance batch file located on the L drive. Run("C:\Program Files (x86)\Pictometry\ChangeAnalysis2.7\ChangeAnalysis.exe") WinWaitActive("ChangeAnalysis -") ;Get the window by using keystrokes Send("!a") Send("{UP}") Send("{Enter}") WinWaitActive("Shapefile/DBF Maintenance") ControlClick("Shapefile/DBF Maintenance", "Browse...", "[ID:2333]") WinActivate("Open", "2") ;Get the file off the L drive Send("L:\PdxBatch09122012.pbt") WinActivate("Open", "10") Send("{Enter}") WinWaitActive("Shapefile/DBF Maintenance") ControlClick("Shapefile/DBF Maintenance", "Run", "[ID:2334]") WinWaitActive("Shapefile/DBF Maintenance", "List1", "30") And I'm attaching a screenshot of the error message: ScriptError.bmp Thank you in advance for any guidance you give!
  18. Thanks for the help! It's running but I notice that sometimes, the first time I run the executable it returns a message "File not found." I double checked my code & I have named the file correctly. If I run the exe again it opens & processes like it should. Maybe it's the use of Ctrl + Keys, but I'll have to work to figure out how to write it without that. It's a drop down menu, I thought using keystroke to access it would be the easiest? Is there a better way?
  19. OK, I will try that, thank you! The title does have some crazy spacing in it, maybe there is a space behind the "-"? Thanks
  20. Hello All- I am having problems trying to write a simple script. I am using SciTe version 3.2.0 & the AU3 Recorder & AutoIt v3. Here’s what the script needs to do: Open a program Go to a file item Select a file by browsing out to the network Then click Open- Then click the Run button - then allow the file to process (this takes about 25 minutes) Then click Done.My code will open the program but then it pauses – the file item never opens (it’s called “Shapefile/DBF Maintenance” in my script. If I click on the AutoIT icon in my tray, it says Script Paused. So I have to Exit out of it. Since I am using the keystrokes to open this file (control + A, & then the up arrow to select that particular item from the drop down), shouldn’t it appear on my screen? All that apparently is happening is the program is opening. I also tried to write it using the WinMenuSelectItem function but didn’t get anywhere with that, either. Below is my code (the ID #s came from the AutoIT Window Info tool): Run("C:\Program Files (x86)\Pictometry\ChangeAnalysis2.7\ChangeAnalysis.exe") WinActivate("Pictometry EFS -") Send("!a") Send("{UP}") Send("{Enter}") WinWaitActive("Annotate/Shapefile/DBF Maintenance") ControlClick("Shapefile/DBF Maintenance", "Browse...", "[ID:2333]") WinActivate("Open", "2") Send("L:\Analyst\PdxBatch.pbt") WinActivate("Open", "10") Send("{Enter}") WinWaitActive("Shapefile/DBF Maintenance") ControlClick("Shapefile/DBF Maintenance", "Run", "[ID:2334]") WinWaitActive("Shapefile/DBF Maintenance", "List1", "30") ControlClick("Shapefile/DBF Maintenance", "Done", "[ID:1]") WinClose("ChangeAnalysis- ")Can anyone tell me what I could be doing wrong? I am running Windows 7, & I do have some issues with permissions over the network but it seems my code stops before I even have to jump that hurdle! Thanks for helping a newbie out!
×
×
  • Create New...