Sivasankar Posted May 15, 2017 Share Posted May 15, 2017 I am new to AutoIt . I have number of files in a folder, need to open the file one by one. Once it opened, saveas file with some other format. is it possible to achieve using AutoIt. Please advise Link to comment Share on other sites More sharing options...
meoit Posted May 15, 2017 Share Posted May 15, 2017 Use FileSaveDialog. Link to comment Share on other sites More sharing options...
rootx Posted May 15, 2017 Share Posted May 15, 2017 5 minutes ago, Sivasankar said: I am new to AutoIt . I have number of files in a folder, need to open the file one by one. Once it opened, saveas file with some other format. is it possible to achieve using AutoIt. Please advise You need _FileListToArrayRec then For Next loop, and open the files with ShellExecute() Link to comment Share on other sites More sharing options...
water Posted May 15, 2017 Share Posted May 15, 2017 It depends. Which types of files (Word, Excel ...) do you need to open and save in another format (PDF ...)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
232showtime Posted May 15, 2017 Share Posted May 15, 2017 39 minutes ago, Sivasankar said: is it possible to achieve using AutoIt. yes. ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Sivasankar Posted May 15, 2017 Author Share Posted May 15, 2017 I have file with .seg format. want to convert this to .tiff format Link to comment Share on other sites More sharing options...
232showtime Posted May 15, 2017 Share Posted May 15, 2017 where is your code??? ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Sivasankar Posted May 16, 2017 Author Share Posted May 16, 2017 @rootx : Thanks for your reply, I got the list of files from folder using FileListToArrayRec. then opened the each document using For Next loop, now I need to do SaveAs the file with same name but different format. I am facing problem like couldn't able to open SaveAs dialog window. Here I tried to convert file docx to rtf. but my actual requirement is convert file .SEG to TIFF format @232showtime: Please check below code, correct me if iam wrong, expandcollapse popup#include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <Word.au3> #include <FileConstants.au3> #include <StringConstants.au3> Example() Func Example() Local $sAutoItDir = StringLeft(@ScriptDir, StringInStr(@ScriptDir, "\", Default, -1)) If StringRight($sAutoItDir, 5) = "beta\" Then $sAutoItDir = StringTrimRight($sAutoItDir, 5) EndIf ConsoleWrite($sAutoItDir & @CRLF) $aArray = _FileListToArrayRec($sAutoItDir, "*.docx", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) _ArrayDisplay($aArray, ".Docx Files") For $i =1 to $aArray[0] MsgBox($MB_SYSTEMMODAL, "", "Count down!" & @CRLF & $aArray[$i]) Local $oWord = _Word_Create() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocSaveAs Example", _ "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $sDocument = $aArray[$i] Local $oDoc = _Word_DocOpen($oWord, $sDocument, Default, Default, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocSaveAs Example", _ "Error opening 'open _Word_Test.doc'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) local $szDrive, $szDir, $szFName, $szExt _PathSplit($aArray[$i], $szDrive, $szDir, $szFName, $szExt) MsgBox(0, $aArray[$i], $szDrive & $szDir); Local $sMessage = "Choose a filename." ;Local $sFileSaveDialog = FileSaveDialog($sMessage, "::{450D8FBA-AD25-11D0-98A8-0800361B1103}", "Scripts (*.xlsx)", $FD_PATHMUSTEXIST,$szFName) Local $sFileSaveDialog = FileSaveDialog($sMessage, $szDrive & $szDir & "te" , "Scripts (*.rtf)", $FD_PATHMUSTEXIST,$szFName) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No file was saved.") Else Local $sFileName = StringTrimLeft($sFileSaveDialog, StringInStr($sFileSaveDialog, "\", $STR_NOCASESENSE, -1)) Local $iExtension = StringInStr($sFileName, ".", $STR_NOCASESENSE) If $iExtension Then If Not (StringTrimLeft($sFileName, $iExtension - 1) = ".rtf") Then $sFileSaveDialog &= ".rtf" Else $sFileSaveDialog &= ".rtf" EndIf MsgBox($MB_SYSTEMMODAL, "", "You saved the following file:" & @CRLF & $sFileSaveDialog) EndIf Next EndFunc ;==>Example Link to comment Share on other sites More sharing options...
KickStarter15 Posted May 16, 2017 Share Posted May 16, 2017 22 hours ago, Sivasankar said: Once it opened, saveas file with some other format. is it possible to achieve using AutoIt. Have you tried having it this way? Other formats were added in "FileSaveDialog()": Local $sFileSaveDialog = FileSaveDialog($sMessage, $szDrive & $szDir & "te" , "TIFF (*.tiff)|JPEG (*.jpeg)|PNG (*.png)", $FD_PATHMUSTEXIST,$szFName) Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
water Posted May 16, 2017 Share Posted May 16, 2017 You can't use FileSaveDialog in this way. To save a document from Word you need to use _Word_DocSaveAs or _Word_DocExport. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 16, 2017 Share Posted May 16, 2017 BTW: You shouldn't have _Word_Create inside the For $i =1 to $aArray[0] loop. Open Word one time at the top of your script and close it before the script ends. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Sivasankar Posted May 17, 2017 Author Share Posted May 17, 2017 Please ignore above code. My requirement is, convert Mainframe file into image format using ELIXIR tool, but manually it takes too long. So plan to achieve the scenario with AutoIT. 1. Get all files from a folder 2. Open each .SEG format file in "ELIXIR" tool 3. Then SaveAs the file with .TIFF format in another location. Please advise Link to comment Share on other sites More sharing options...
spudw2k Posted May 17, 2017 Share Posted May 17, 2017 I'm not familiar with the tool, and all the docs I've seen for what I "think" it might be...it looks like a fairly old application. I would look through the documentation to see if there are any command-line operations to execute the tool and do the conversion. That may be the easiest and/or most elegant way to automate it. Otherwise, you can try automating keystrokes and clicks based on keyboard shortcuts and window location. What would be ideal is if you can use the Au3Info tool included with AutoIt to identify the controls in the GUI and use the more robust Control* functions to automate the GUI...much less room for error versus sending keystrokes and mouse clicks. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
rootx Posted May 26, 2017 Share Posted May 26, 2017 (edited) On 17/5/2017 at 7:41 AM, Sivasankar said: Please ignore above code. My requirement is, convert Mainframe file into image format using ELIXIR tool, but manually it takes too long. So plan to achieve the scenario with AutoIT. 1. Get all files from a folder 2. Open each .SEG format file in "ELIXIR" tool 3. Then SaveAs the file with .TIFF format in another location. Please advise 1. use _FileListToArrayRec to get all file.... .SEG 2. Inside the loop FOR ... NEXT execute ELIXIR tool to convert it one by one 3 Put an If control to chek if the file is converted and exist than copy it with filecopy PS: you need to set ELIXIR global varible in windows and test it with cmd if everithing is ok you can use shellexecutewait or Runwait Edited May 26, 2017 by rootx Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now