Saving a text file in Emeditor with a custom name using Javascript - emeditor

I want to save a document without popping up the "Save As" window. The name of the file document be specified before saving, how can I do that?
I know that there is a command called document.Save( [ strName ] ); Sadly, it allows me to save the document with numbers only. I want to save the document with words (a,b,c,..) as well.

Related

How can I use Power Automate to rename an attachment using the entered Title on SharePoint Lists

I am looking to automate the renaming of an attachment using the Title entered when the attachment is uploaded to SharePoint lists, i.e. have the user designate the name/title of their attachment.
Thus far I can add a date stamp in Add Attachment, File name. But this uses the current file name. concat(formatDateTime(addHours(utcNow(), -8),'MMM-dd'), items('Apply_to_each')?['DisplayName']).
Would appreciate any suggestions on how to apply the SharePoint List Title in the renaming or add file command.
Thanks!
Try an expression like below to use the title of the list item from the trigger action:
concat(formatDateTime(addHours(utcNow(), -8),'MMM-dd'), triggeroutputs()?['Title'])

vb6 common dialog box save as, which file extension was chosen

With the common dialog control, lets say I set
.Filter = "Text (.txt)|*.txt|Comma Separated (.csv)|*.csv|Excel (.xls)|*.xls"
If the user does not explicitly type .txt or .csv or .xls but just enters a filename, how does one know WHICH extension they want it saved as?
As you have noticed, FilterIndex can unfortunately only be used to specify the default filter, and the Common Dialog Control will not actually give you the filter selected by the user.
I too had to do the same and switch to the Win32 API version. Here's a well written example and goes into great detail about the use of the GetSaveFileName() API and OPENFILENAME structure:
http://www.jasinskionline.com/windowsapi/ref/g/getsavefilename.html
At which point, you can use the filebox.nFilterIndex parameter after the GetSaveFileName() call to see what the user had actually selected.

How to add inline graphics programmatically into a table cell in InDesign

I have a table in an InDesign document. I will to add an inline image to the first cell.
var myPics = File("/c/test.png"),
myDoc = app.activeDocument,
myPage = myDoc.pages[0],
myTable = myDoc.stories.everyItem().tables[0],
myCell = myTable.cells[0];
myCell.contents = myPics;
I expect there should be an image put into the cell, but the file address is filled instead. What should I do?
The contents of text objects in InDesign are not exact equivalents of actual formatted native InDesign text; they are always cast to and from simple Javascript text strings. Reading the contents discards all of InDesign's text attributes (for instance, text formatting, hyperlinks, bookmarks, XML markers, and all meta-objects such as images); and writing contents fills the destination with plain text, formatted with the default formatting of the text container at the location you place the text.
You cannot store a PNG file "in" a Javascript variable; not as a File object (it will not be parsed into the actual file's contents), and not as 'an image' (the contents will be treated as a text string, not 'meaning' anything).
The proper way is to use place, which can work on an InDesign document as a whole, in which case the file will be imported directly 'on' a page, or using a text location through a valid property such as its insertionPoints:
var myPics = File("/c/test.png"),
myDoc = app.activeDocument,
myPage = myDoc.pages[0],
myTable = myDoc.stories.everyItem().tables[0],
myCell = myTable.cells[0];
myCell.insertionPoints[0].place(myPics);
If you want make sure the contents of myCell is empty before placing, you can add
if (myCell.texts[0].length > 0)
myCell.texts[0].remove();
A warning on your use of everyItem(): when used this way, it is a live collection. A collection acts like an array, except that each element of the collection is 'seen' as the one and only object. Thus, you can do something like
myTable.cells.everyItem().contents = "hello!";
and the text will appear in every single cell, because of the everyItem() command. But since you already created a collection of tables -- myDoc.stories.everyItem().tables[0] will be a list of "the" first table in all of the current document's stories -- you will find, to your surprise, that all of these will suddenly contain hello as well.
You can see this if you place a copy of your current text frame on the same page and run my version of your script again. You will find it inserts the same image in both the tables!
Presumably you want to insert the image only once, in the first table, in the first story, on the first page. That would then be
myTable = myPage.stories[0].tables[0];

Visual Studio: Use csv file for "Find Text" validation in web performance test

I can use csv files to enter data into input field after a test is recorded. I was wondering if csv file could be used for "Find Text" validation field. I don't see options to add csv file so I have directly hardcode text be checked. If I could add a csv file then I would just need to change the csv file once the website texts are changed. Could this be done by using codedUI test?
Thank you
The fields of a data source can be used in many places within a Web Performance Test. There are two main ways.
In the properties panel for the call of the validation rule, click in the value field for the required property. You should get a box allowing the data source field to be chosen.
Alternatively enter text similar to the following into the field
{{DataSource1.YourFileName#csv.FieldName}}
Note the doubled curly braces {{ and }} around the full data source string. You can also add extra text to this sort of entry, eg
Some text{{DataSource1.YourFileName#csv.FieldName}}and even more text

Applescript + Microsoft Word -- file types for "save as"?

I am trying to write a script to save a Word document in the single-file webpage (.mht) format. I am up to the part where I write the actual "save" command, and I'm stuck there. This is what I am trying to do:
# the_file is a variable which has been set here
tell application "Microsoft Word"
activate
open the_file
save the_file as [type]
end tell
The open part works just fine. But I don't know what to put in for the save type. Perhaps more importantly, I don't know where I can find a list of the available types. Can anyone help?
EDIT: A commenter suggested the word dictionary; I found the following there but don't know how to interpret it [I'm an AS noob].
[file format format document97/‌format document97/‌format template97/‌format template97/‌format text/‌format text line breaks/‌format dostext/‌format dostext line breaks/‌format rtf/‌format Unicode text/‌format Unicode text/‌format HTML/‌format web archive/‌format stationery/‌format xml/‌format document/‌format documentME/‌format template/‌format templateME/‌format PDF/‌format flat document/‌format flat documentME/‌format flat template/‌format flat templateME/‌format custom dictionary/‌format exclude dictionary/‌format documentAuto/‌format templateAuto] : The format in which the document is saved.
Try format web archive. Of all the formats listed, that one looks the most likely.
1- You must specify a document when using the save command, not the file path.
For better control, use the open command with the property file name, it return the document object.
When using this : open the_file, it return nothing, in this case you must use front document, but it's unreliable, for example if another document opens after.
2- Word does not change the extension when using the save command in Applescript, the script must replace the extension.
Also, I recommend the command save as to have more options instead of save.
Answer updated : format HTML instead of Web archive
set the_file to (choose file)
tell application "Microsoft Word"
set thisDoc to open file name (the_file as string)
set tName to my removeExtension(name of thisDoc)
-- save in the same directory
save as thisDoc file format format HTML file name (tName & ".htm") with HTML display only output
close thisDoc saving no
end tell
on removeExtension(t)
if t does not contain "." then return t
set tid to text item delimiters
set text item delimiters to "."
set t to (text items 1 thru -2 of t) as string
set text item delimiters to tid
return t
end removeExtension
If you don't want HTML display only output, use without HTML display only output

Resources