Jump to content

Easy beginners question, closing windows opened with Send()


Recommended Posts

Gentlemen and possibly ladies,

I am new to the AutoIt world and trying to get my feet wet. Basically Im creating a script to access a shared folder on the server, copy it, paste to the users desktop, overwrite the previous version, run it in Filemaker, help Filemaker convert it from Version 3 to 9. I dont know much and have pretty much just been using the keyboard and shortcuts to do so. It is basically a lot of sleeps and single/combo button hits. My main question would be, once I open the folder at the server location or the desktop, how do I close it after the file has been copied/pasted? Does Send() use a PID that I can use to close it with ProcessClose()?

Here's the poo-tastic code, feel free to poke fun and guide to a smoother way to do it. If not, Ill settle for a list of commands that allow me to use the mouse in this process to phase out all the tabs and Enters.

Local $answer = MsgBox(4, "Rob First Crack at it", "This script will open the guardian folder, copy and paste the job catalog.  Run?")


If $answer = 7 Then
    MsgBox(0, "Guess its not for you. :(", "OK.  Bye!")
    Exit
EndIf

Send("#r")
Sleep(200)
Send("\\server\Sales\Shared\")         ;;Location of the server folder that the file resides in
Sleep(600)
Send("{ENTER}")                       
Sleep(400)
Send("b")                                           ;;The letter "b" here was used because the top folder in the "Shared" folder starts with "b", thus giving me a common starting point to go from
Sleep(400)
Send("{DOWN 10}")                           ;;The file that I am accessing is 10 files below the top one, thus down arrowing to the one I want
Sleep(300)
Send("^c")
Sleep(300)
Send("#r")
Sleep(300)
Send("C:\Users\PCuser\Desktop")  ;;Location of the Users Desktop, only real way I knew how to access it to copy to
Sleep(300)
Send("{ENTER}")
Sleep(400)
Send("^v")
Sleep(1000)
Send("{UP 3}")                                 ;;On Windows 7, a copy and replace window appears if the file already exists in that location.  Hitting the up arrow 3 times highlights the Copy and replace button.
Sleep(250)
Send("{ENTER}")
Sleep(400)
Send("{ENTER}")
Sleep(400)

And yes I stole the first couple lines from the examples to see how it interacted. I have some basic Java skills from college Java classes so programming and how things are linked arent new to me, just the syntax wording of the new lanuage.

Link to comment
Share on other sites

What's wrong with FileCopy instead of trying to automate the command line interface? If you know the name of the file, just use that instead of all this down arrow, control-c stuff.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

The reason I didnt use it was because I was unaware of the calling, you have a list of those commands anywhere?

That pretty much took care of thy entire code and put it into one line, thanks.

Any way to help Filemaker through its processes without simply keyboard interactions, like mouse clicks?

Link to comment
Share on other sites

If you look in the help file that comes with the download of AutoIt3 you will find a listing of all the functions and commands available.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Perhaps Im not using the FileOpen function correctly,

FileCopy("serverSalesSharedCatalog.fp3", "C:UsersPC_UserDesktop", 1)
Sleep(400)
FileOpen("C:UsersPC_UserDesktopCatalog.fp3", 1)

This doesnt open the file with anything and if I change the insides of FileOpen to just "Catalog.fp3" it just creates a new file named that in my Autoit File location. Any idea?

Link to comment
Share on other sites

  • Developers

What did you expect to happen when doing a FileOpen() for that file?

It does open the file but am I right to assume you want to launch the application associated with the files extension?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

What is the function to wait until a dialog box apears, such as a Save As box?

You will have to do a couple of things when you want to be more effective in this forum:

- stop asking these generic questions and be much more explicit.

- Try to do a little research before asking, because there is no way you can explain to me you can have this question researched yourself first.

- Open the helpfile and have a look there.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

GeneralDisarray,

If you keep asking simple questions like this, you will annoy others so much that you will soon get no answers. You need to do some work as well. :)

Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page).

There are even video tutorials on YouTube if you prefer watching to reading.

I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks Blue,

Yea that would have eased the issue with the initial question.

Beginning to understand some more of the initial stuff. Using WinWait instead of timed sleeps, think Im starting to grasp PIDs and handles as they relate to windows and how to retrieve that info. The Help file as requested was very "helpful" but there is a basic theory question I have regarding my still current problem of clicking a checkbox in a non-autoit window. I have a work around for it by using WinMove to 0,0 and MouseMove with MouseClick to manually uncheck the always checked box but am sure there is a different, less archaic way to do it. I assume Im going to need either the PID or handle of the Window in question with the box and then use a function Im not aware of. Ive Googled the poo out of this question and all I get are IE related or doing it with an Autoit created GUI box. Im pretty sure nothing in Win can help and if my thinking is correct all the GUI functions are for created GUIs from Autoit. If thats the case, I have no idea how to go about starting this procedure. Not looking for a handout or code but a gentle nudge in the right direction would help. It is also possible that, in my infinite noob-dom, this may not be attainable for someone in the early stages of learning and with that Im in understanding but if someone could say, "look towards SuperCheckBox function in conjunction with some stuff from the Win functions," I would be in your debt.

Thanks again.

Link to comment
Share on other sites

Control handles work. You could try and get the handle of that particular control: ControlGetHandle() and take a look at ControlCommand() (Specifically "IsChecked" and "UnCheck")

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...