Sign in to follow this  
Followers 0
marshallprank

Problem with open txt file

18 posts in this topic

Hi,

i have a tool (txt in xml converter) which contains a OpenFiel dialog Button. If a click on this Button, i should choose a txt.file on my PC, when i choosed it the OpenDialog will disappear and another OpenFile Dialog will appear to select another file. i would to do this steps with AutoIt.

It is not working properly. When the first OpenFile Dialog appear, i put the link of txt.file (C:\ABC\test.txt) with ClipPut(...) then i sent ENTER (Send("{Enter}")). After this Step the second OpenFile dialog does not appear. What is wrong?

manualy wihtout AutoIt it is working when i put C:\ABC\test.txt then i put ENTER with the keyboard the second OpenFile Dialog will appear.

thanks and Regards

Share this post


Link to post
Share on other sites



and your code is???


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is my code:

$LogFileName = test.txt
$ScriptPath=C:ABC
$LogFilePath= $ScriptPath & $LogFileName ;C:ABCtest.txt
$temp = FileOpen("temp.txt", 1)
   FileWrite($temp, $LogFilePath)
$readLine=FileReadLine ("temp.txt", 1)
run($ReportingPath) ; to call my tool
WinWaitActive("ATS SystemTester","...",$Timeout) ; to open the first OpenFile Dialog
ControlClick("ATS SystemTester","...", "...") ; to open the first OpenFile Dialog
   ClipPut($readline)
  Send("^v")   ; this will put the path C:ABCtest.txt in the field

After the last step Send("^v"), the second OpenFile Dialog should appear. Also if i delete Send("^v") from my code and run the script, then i put manualy with the keyboard Enter, than works and the second OpenFile Dialog appears.

Edited by marshallprank

Share this post


Link to post
Share on other sites

Please use the AutoIt tags when posting your code

From the code you posted it is hard to tell what the problem could be.

Apparently the code you are having the problem with is in the "$ReportingPath" (your tool) which we have no information on whatsoever.


If you try to fail and succeed which have you done?AutoIt Forum Search

Share this post


Link to post
Share on other sites

my tool working. And run($ReportingPath) works. If i do the same steps but wihout Send("^v") and when script ends than i put manualy with the keyboard Enter, than works and the second OpenFile Dialog appears. See the Code:

$LogFileName = test.txt
$ScriptPath=C:ABC
$LogFilePath= $ScriptPath & $LogFileName ;C:ABCtest.txt
$temp = FileOpen("temp.txt", 1)
   FileWrite($temp, $LogFilePath)
$readLine=FileReadLine ("temp.txt", 1)
run($ReportingPath) ; to call my tool
WinWaitActive("ATS SystemTester","...",$Timeout) ; to open the first OpenFile Dialog
ControlClick("ATS SystemTester","...", "...") ; to open the first OpenFile Dialog
   ClipPut($readline)

Share this post


Link to post
Share on other sites

If this is your actual code, you need quotes around the strings in the $ScriptPath and $LogFilePath variable assignments otherwise they're not going to work. Also, why do you use FileOpen and then read the line from the file using the relative file name? You might want to use some consolewrites to see if the variables contain what you think they contain as a check to see if you're reading the correct information from the file.


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

Share this post


Link to post
Share on other sites

That can't be your actual code, half of what you posted previously is missing. Including all the points I made about the quotes around your strings. So, where is your ACTUAL code.

Also, does your controlclick work at all the way you have it written? Because you're clicking on a blank controlID. If you don't post the actual code you're using I can't help and I'm out of here.


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

Share this post


Link to post
Share on other sites

Here the code:

#include <file.au3>
#include <Process.au3>

$Timeout=IniRead(@ScriptDir & "Config.ini", "TimeOut", "Timeout","NotFound") ;
$ReportingPath=IniRead(@ScriptDir & "Config.ini", "ReportingPath", "ATSSystemTester","NotFound")
$ScriptPath=IniRead(@ScriptDir & "Config.ini", "ScriptPath", "Script","NotFound")
$LogFileName = "test.txt"
$LogFilePath= $ScriptPath & $LogFileName

ClipPut($LogFilePath)
run($ReportingPath)
  
WinWaitActive("ATS SystemTester","...",$Timeout)
ControlClick("ATS SystemTester","...", "...")
 
Send("^v")
Sleep(3000)
Send("{Enter}")
Sleep(2000)

till the step Send("{Enter}") works. After Send("{Enter}") the second OpenFile Dialog does'nt appear.

Share this post


Link to post
Share on other sites

Here the code:

till the step Send("{Enter}") works. After Send("{Enter}") the second OpenFile Dialog does'nt appear.

Where is the second OpenFile dialog activated? If the ControlClick activates the dialog box, you only have one in the script, so how is this box supposed to open, and what are you trying to put into it?

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

Share this post


Link to post
Share on other sites

The second OpenFile dialog is specific to my tool , that you can add a referenc xml file. You have to put in the first OpenDialog File the txt file and in the second the xml file.

Share this post


Link to post
Share on other sites

i tested now with sleep(20000) on the end of script and i have assertet that as long as the script run it is unable to open the second OpenFile Dialog. when the sleep time is expred ,i tried to put manualy the link, the second OpenFile Dialog is coming.

Is this issue familiar?

Share this post


Link to post
Share on other sites

Not sure what the issue is with your program, but why are you using

ClipPut($LogFilePath) and Send("^v") instead of simply Send($LogFilePath & "{ENTER}")?

Share this post


Link to post
Share on other sites

i tried also. The same problem is occured.

Share this post


Link to post
Share on other sites

I'd guess the problem lies in the parts of whatever script you're using that you're not posting. Obviously we're NEVER going to be able to help you because you refuse to post a reproducer script that demonstrates the problem. I've asked you to post the script you're using to accomplish what you want, and every time you post something it usually shows very little relation to what you posted before, and the parts of the script that aren't working aren't posted at all.

Do you really want help getting this fixed, or are you just jerking our chain to see how far you can take this? If you can't or won't post the parts of the script that don't work, and the parts of the script that do work, then you are on your own. Good luck, the ball is in your court for the last time as far as I'm concerned.


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

Share this post


Link to post
Share on other sites

this is all my script. My tool (converter) is not possible to share it because of rights.

Share this post


Link to post
Share on other sites

Are you saying that your tool program automatically pops up another file open dialog after entering the first filename followed by an enter? If so the problem is with the tool, not the autoit script.

Try putting EXIT on the line immediately after Send("{Enter}"). Or try making the script click on an OK button or whatever is there instead of sending an ENTER to the dialog... ENTER invokes the default action in a window but perhaps that's not what you want?

Share this post


Link to post
Share on other sites

thank you very much. Now its working with EXIT after Send("{ENTER}") :D

Share this post


Link to post
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
Sign in to follow this  
Followers 0