How to create a UTF-8 encoded text file using do shell script?
As I understand it, the command should start with do shell script. And what to write next?
Post
Replies
Boosts
Views
Activity
Hello.
How to write this command correctly on a Macbook, in the script editor, so that I can click the "Run script" button and the script will give the result:
if there is no folder, then report that there is no folder,
if there is a folder, then report that the folder exists.
do shell script "test -d 'Users/user/Desktop/New folder'"
Now, if the folder exists, an empty string ("") is returned, if the folder does not exist, the script editor reports that an error has occurred.
In general, my task is to write a script that checks the existence of a folder.
Where can I read the help for all Do Shell Script commands?
For example, there is a "test" command. Which reference book mentions this command? I.e. I want to go to some website, all the Do Shell Script commands will be there, and among these commands I will find the "test" command.
Or are there no such directories and the programmer should randomly find commands on the Internet on random sites?
See the screenshots. First, the item "Commands Reference" is on the first level. I click on the arrow, the item "Commands Reference" goes to the second level. I click on the arrow again, the item "Commands Reference" remains in the second level.
Here is the help for the "open for access" command. In the Syntax - Parameters section, the first parameter is not specified, but immediately write something in parentheses. In the "write" command, it is done differently.
https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW31
This code does not make sense, I would just like to get information based on it.
set MyData to "MyData1|MyData2"
on MyScript(MyData)
set MyVar1 to "MyData1"
set MyVar2 to "MyData2"
return MyVar1 & "|" & MyVar2
end MyScript
The text is passed in the code: "MyData1|MyData2". I need to divide it into two parts by the "|" symbol. And write each part into two variables: myVar1 and myVar2.
How to do it?
P.S. The problem is that only one parameter can be passed to on...end. I need to pass two. I'll pass one, then split it into two.
Where can I see the entire list of commands for the "TextEdit" program? For example, there is a code:
tell application "TextEdit"
activate
make new document with properties {text:"XDXDXD"}
end tell
There are two commands in this code:
activate
make new document with properties {text:"XDXDXD"}
Where can I see all the available commands for the "TextEdit" program?
How to do these actions using AppleScript:
launching the TextEdit program
setting TextEdit to be plain text (not formatted), UTF-8
creating an empty file
writing clipboard contents to a file
saving the file to the desktop
closing the file
How to create an xml file in VBA? The text can contain any characters: " (quotation mark), ' (apostrophe), etc. For example, in AppleScript, the printf, echo commands convert the source text: for example, ' (apostrophe) is deleted. It is necessary that the Mac does not convert anything at all, but writes to a file what it is given.
How to create a UTF-8 encoded text file in VBA?
The text can contain any characters: " (quotation mark), ' (apostrophe), etc. For example, in AppleScript, the printf, echo commands convert the source text: for example, ' (apostrophe) is deleted. It is necessary that the Mac does not convert anything at all, but writes to a file what it is given.
Hello. How in AppleScript to get a list of all files in all subfolders without any conditions?
I understand I need to use find.
What the code will look like without any conditions, I need to get absolutely all the files: no matter the extension, no matter the file name.
The only thing I would like is not to receive hidden files.
Where to read about the iregex syntax: how to make a command?
There are three basic types of regular expressions: basic regular expressions, extended regular expressions, and Perl regular expressions.
In -regex what type is used?