Jump to content

how to send a long string to open dialog of a program using AutoIt v3


Recommended Posts

I need to send a long string of input names to open dialog of a program. I've tried send() function but it can't do this completely. I think because of OS context switch send() function sends some part of the string to another program.

following code is some part of my script:

$ftmp = ""
while 1
  $fname = FileReadLine($file)
  if @error = -1 then ExitLoop
  $ftmp = $ftmp & $fname & " "
WEnd 
send("^o")
WinActivate("Open Image")
sleep(100)
send($fadrs)
Sleep(200)
send("{ENTER}")
sleep(10)
send($ftmp)
Sleep(100)
send("{ENTER}")
Link to comment
Share on other sites

  • Moderators

Hi, nimany, welcome to the forum. You could always read the entire file into an Array, and then parse it out. This should also be much faster the a bunch of FileReadLines. The example below should get you started down the road :)

#include <file.au3>
#include <Array.au3>

$file = @DesktopDir & "Test.txt"
Local $aArray

_FileReadToArray($file, $aArray)

For $element in $aArray
  ConsoleWrite($element & " " & $file)
Next

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi, nimany, welcome to the forum. You could always read the entire file into an Array, and then parse it out. This should also be much faster the a bunch of FileReadLines. The example below should get you started down the road :)

#include <file.au3>
#include <Array.au3>

$file = @DesktopDir & "Test.txt"
Local $aArray

_FileReadToArray($file, $aArray)

For $element in $aArray
ConsoleWrite($element & " " & $file)
Next

Thank you dear jlogan3o13 for answering
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...