Jump to content

Recommended Posts

Posted (edited)

Hello there,

Is it possible to perform specific Func for every file found separately ? 

 

Thank you in advance.

 

 

Edited by rkskaras
  • Developers
Posted
1 minute ago, rkskaras said:

Is it possible to perform specific Func for every file found separately ? 

Yes, just loop through the result returned in the Array.
Any more specific answer requires a much more detailed requirement description and code tried that isn't working. :) 

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.
  :)

Posted

Thank you for replies, 

I have just basic knowledge about AutoIt, can you help me with it ? 

I have this script,

$aArray = _FileListToArray($ini1, "*.sse", 0)

$files = _ArrayToString($aArray,@CRLF,1)
Local $filess = StringTrimLeft($files, 7)
$Files = StringRegExpReplace($Filess, "^.*\\|\..*$", "")

Basically this finds the file APP-TR APP.sse next it puts APP-TR APP.sse into string and cuts first seven letters from left and than it removes the extension so i have just APP.

$ini1 is folder path in INI file.

Next it performs action a much complicated action 

$hWnd = WinGetHandle("config - studio")
WinActivate($hWnd)
Sleep(2000)
$hTreeView = ControlGetHandle($hWnd, "", "[CLASS:SysTreeView32; INSTANCE:1]")

$iExists = ControlTreeView($hWnd, "", $hTreeView, "Exists", "#0|#0|#1|#0|#8|" & "TR " & $files)

If $iExists = 1 Then
    ControlTreeView($hWnd, "", $hTreeView, "Select", "#0|#0|#1|#0|#8|" & "TR " & $files)

Sleep(1000)
ControlSend($hWnd, "", "", "{ALT}")
ControlSend($hWnd, "", "", "{D}")
ControlSend($hWnd, "", "", "{DOWN}")
ControlSend($hWnd, "", "", "{DOWN}")
ControlSend($hWnd, "", "", "{ENTER}")

Sleep(1000)

ControlClick("Speichern unter", "", "[CLASS:ToolbarWindow32; INSTANCE:3]" , "left", 1)
ControlSetText("Speichern unter", "", "Edit2", $ini1)
Sleep(500)
ControlSend($hWnd, "", "", "{ENTER}")
Sleep(1000)
ControlSetText("Speichern unter", "", "Edit1", "")
Sleep(1000)
ControlSend("Speichern unter", "", "Edit1", "APP-TR " & $files & "_old")
Sleep(500)
ControlClick("Speichern unter", "", "Button1")
Else
    MsgBox(0, "Error", "Application " & $files & " not found.")
    Exit
EndIf

The APP in the string is the name of Application that is in the folder but also APP is an application in one software.

 

Could you please help me to make it do this specific action for every other files in that folder ? I only tested it with one file in the folder.

  • Developers
Posted

Let's start simple by just getting all files and loop through the result. When you have thaat working you can perform a Func for each file.
Here is an example how you could start which shows you the found files and converted results:

#include<File.au3>
$ini1 = "C:\temp"
$aArray = _FileListToArray($ini1, "*.sse", 0)
If @error Then
    ConsoleWrite(" No files found in " & $ini1 & @CRLF)
    Exit
EndIf
For $x = 1 to $aArray[0]
    Local $Files = $aArray[$x]
    Local $Files2 = StringTrimLeft($Files, 7)
    Local $Files3 = StringRegExpReplace($Files2, "^.*\\|\..*$", "")
    ConsoleWrite($x & "  $Files=" & $Files & "      $Files2=" & $Files2 & "       $Files3=" & $Files3 & @CRLF)
Next

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.
  :)

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
×
×
  • Create New...