I need to open some files in a folder that contains "RPA" in their name. so how can I do that in automation anywhere? - automationanywhere

I am creating a program that opens files in a folder that contains "RPA" in their name. so, how can I do that?

You will use Loop on File in Folder command, and if condition inside the loop to check if the file name includes RPA.
Loop on Files on Folder
If condition $Filename$ includes RPA
Do Something here eg. open program/file command
End If
End Loop

#Shivam,
To get more clarity on your problem statement, you mentioned once that the files are already in PDF.
Are you trying to copy content from PDF to Word? In that case, you could use PDF Integration commands, provided the PDFs are not hand-written or scans. If that is the case, the text extraction might become more unreliable.
A safe bet with Automation Anywhere is to just extract all the text, open a new Word document and paste the content and save file.
Saving all files as word might a little counter-intuitive. You can just use the If statement within your for loop to only process files with "RPA" in their name.
Hope this help. Let us know you go :-)

its pretty simple use includes in your if statement
workbench snapshot

Related

How do I add files to my app and find their path to access them

I have some txt files that store some important data for my app. Due to its nature I want them to be in external text files. Currently i plan on reading them using a streamreader that reads the txt line by line. However, i don't know where to put my txt files, so i can access them in my streamreader which requires their path. Ive seen examples of using NSBundle.mainBundlepathforResource. However, I'm not really sure what a Bundle is or how to place my files there in the first place.
You can use NSBundle. Here's another answer that shows how to create and use bundles: https://stackoverflow.com/a/23884501/1228075

How to save multiple files at once through delphi save dialog

I'm not able to save multiple files at a time in delphi save dialog box. Multiple files means I want save files without mentioning anything(or only asterisk) at "filename" field in delphi TsaveDialog. Please let me know how to achieve that.
Of course not, because that is not what it is intended for. You CANNOT obtain multiple filenames from a single save dialog. It only provides one filename at a time. That is by design.
I suspect what you really want is to prompt the user for just a folder path instead. Use the SelectDirectory() function (or the Win32 SHBrowseForFolder() function directly) for that, then you can create whatever files you need in that folder.
The save dialog doesn't save files. It allows the user to select file names. The save dialog doesn't support multiple selection so if you want to have a file dialog that allows multiple selections you need an open dialog. But an open dialog typically is used to select names of existing files, whereas a save dialog can specify a name of a file that does not yet exist.
Wildcards when entered into file dialogs are used to filter the displayed list of files. The file dialog won't return file names containing wildcards.
You imagine using wildcards, but how would you be able to do that and create new files? Wildcards are used to pattern match against existing files.
Maybe what you need is a folder selection dialog. Or perhaps you should ask the user for the name of the "master" file and then you generate the names of the "auxiliary" files using the master file name as a stem. I'm guessing because you've not told us any specifics behind your question.
My advice is to reconsider carefully what you are attempting to achieve. Think of all possible corner cases. Explore what UI idioms are used by other programs. Make sure you understand fully the capability of the file dialog controls. And then design your UI to fit with all of these constraints.

Download Directory and Contents

Is it possible to persuade the stream result to download an entire directory and it's contents? And if so, how? I've no problem getting it to download individual files, but I have a need to download a series of files that must be in a specific directory structure.
I don't think so.
Stream result allow you to download ONE content, with its MIME type, its name, etc.
This makes it impossible to work with a lot of files, with different names and content type.
What you can do is:
Render in a JSP the list of files (in anchor tags for example), everyone targeting the Action that will download that single file;
Call multiple Actions via scripting opening multiple pages (target="_blank") for every file you have (dangerous, annoying, almost useless...);
Create a zip with Java in server side, containing all your files and directories, then output the zip with Stream result.
I think you may consider the third option.

Need help opening printer spool shadow file (.SHD) that is locked

I'm interested in some information inside a shadow file (.shd) located inside the windows print spooling directory "C:\Windows\System32\spool\PRINTERS". Every time a print job is started, a spool file (.spl) and a shadow file (.shd) are created in that directory. So far I have been successful in detecting when a print job has started, and have been able to pause that print job. If you don't pause the job, the files eventually make their way to the printer and then are deleted by windows.
My problem is. I cannot open the .SHD files because they are locked in such a way that you can not read them while they are open by the sprint spooler. I've even tried going to the file in windows explorer and simply copying the file to another file, and that didn't work either. The .SPL spool files I can open though. I simply wait, and fairly quickly the spooler release that file. For the shadow file though, it permanently holds on to this file. Unfortunately, its the one I need.
The line of code I'm using specifically to open the file is as follows:
m_spoolJobStream = new FileStream(spoolFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
The IOException I get is:
The process cannot access the file 'C:\Windows\system32\spool\PRINTERS\FP00083.SHD' because it is being used by another process.
So yes, it is being used by another process. Its being used by the window's print spooler service. But I don't think there is anything I can do about that. All I want to do is read the file. I don't want to make any changes to it. Is there anything I can do here or am I just screwed?
Check the option: "Keep printed documents" (if you have HP printer) and then see your spool file folder, both shadow and spool files would be there.
Well, I did not find a way around this problem. I suspect there is no solution for this and it is by design. However I did find another way to get the information I wanted (at least it seems so thus far).
I'm using the FindNextPrinterChangeNotification() routine out of the winspool.drv library. This guy returns a pointer to a PRINTER_NOTIFY_INFO structure, which in turn contains an array of PRINTER_NOTIFY_INFO_DATA structures. Within that array, there is an element with its "Field" member marked as "JOB_NOTIFY_FIELD_DEVMODE". This element contains a fairly large structure of type DEVMODE. The structure is explained by M$ here http://msdn.microsoft.com/en-us/library/dd183565%28v=vs.85%29.aspx . This structure looks like it contains what I'm looking for and apparently is wrapped up in the .SHD file anyways according to this page http://www.undocprint.org/formats/winspool/shd. I'd like to know what else is in that .SHD file, but I still can't open it because its locked while the job is paused, and I suspect that it stays locked until the job is complete. Oh well, I think my new solution is more elegant anyways.
Just make sure you pause the job in the spool on BOTH your box and the server, then you should be able to copy/open/move the shd file just like you can the spl file. Worked for me, anyway...
This works for me:
- Hang your printer (e.g. jam the paper)
- Print and observe .SHD and .SPL being created
- Stop Print Spooler
- Open the file
The problem might be the FileShare.ReadWrite parameter. You're asking to read and write on the file and maybe that's why you get an error. You should try asking for read-only permission.

How do I find out the path of the file triggered by opening a file with a custom file extension?

How do i get the location of the file that i used to open my programs with?
Example: if i create a new extention ".xyz" say and i tell windows that i want to open the file type .xyz with myapplication, then it starts my aplication. Great, but how does my application get a handle on the file path of the file that was used to start it?
Also, is there a way to keep just one version of my app running and new files that are opened to just call a method in my application? For example if your using a torrent and you open 5 .torrent files they all just get passed to one application.
Side question: are all file extensions 3 letters long and is there a list of ones that are publicly used? If im creating a file extension I don't want to use one that is already used.
When you created your file association, you specified the command line that Explorer should run to activate your program. The shell puts the name of the document file on the command line, too, so in your program, check the command-line arguments. How you do that depends on your language and development environment. In Delphi, use the ParamCount and ParamStr functions.
When you create the file association, you can specify exactly where on the command line the document file name should go. Use %1 somewhere on the command line, and the shell will replace it with the file name. Since Windows file names frequently contains spaces, you should put quotation marks around the file name, so the command line in the file association would look like this:
ArthurApp.exe "%1"
With that association, double-clicking another document file will start another instance of your program. If you'd prefer to have the document opened in another window of the already-running instance, then you can write code to make your program look for already-running instances when it starts up. If it finds one, then it can communicate with that instance to tell it what file to open. You can effect that communication any number of ways, including mailslots, sockets, named pipes, memory-mapped files, and DDE.
The shell's file-association mechanism already has a way of communicating via DDE, so a second instance of your program wouldn't be started at all. Instead, the shell would start a DDE conversation with the already-running instance and tell it the new file name that way. However, DDE seems to be falling out of favor nowadays, so check out some of the other options first.
For your side question, no, extensions are not always three characters long. Look around, and that should be obvious: C code goes in .c files, Adobe Illustrator graphics go in .ai files, and new Microsoft Word documents go in .docx files.
But beware. If you ask for **.doc*, the results will include .docx files as well. That's because FindFirstFile matches both short and long file names, and long file names with long file extensions have three-character extensions in their short-file-name versions.
Rob covered the answer to your question(s) beautifully.
As to the last part, whether there is a public list of file extensions - not as such, but there is shell.windows.com, the web service Explorer uses to locate handlers for unknown file extensions. You can make up an extension then query shell.windows.com to see whether it's been registered. For example, to check whether the extension .blah has been registered by anyone on shell.windows.com, just open this URL in any browser:
http://shell.windows.com/fileassoc/0409/xml/redir.asp?ext=blah
Of course, replace the trailing blah with your extension.
You can find more details about this in KB929149 and in Raymond Chen's post Where does shell.windows.com get information about file extensions, and how do I get in on that action?.

Resources