On 15.03.2010, at 12:15, Kino wrote:
> On Mar 15, 2010, at 5:01 AM, Žorvaršur Davķšsson wrote:
>
>> How can I save a document on the desktop with a macro using a text
>> selection from the document?
>>
>> In Nisus Classic I used this:
>> Copy
>> Save
>> Paste
>> Enter [this would simulate the Enter or the Return key, I have
>> forgotten how this macro command exactly looked like in Nisus
>> Classic]
>
> "Paste" and "Send Text" do not work for Save As dialog box. A bug
> or some limitation of the dialog box?
Yes, that's a pity because it worked beautifully in Nisus Classic.
> Anyway, I think the following will do the job. (
)
Thanks Kino, I'll try this.
>
> Attention: the macro overwrite a file of the same name in the same
> location without warning.
So I guess there is no way to include a warning in the macro?
>
>> Today I wanted to test the following lines:
>>
>> $path = '/Users/meinewenigkeit/Desktop
>> $name = Read Selection
>> $name = $name &= .rtf
>> Save to $path, $name
>>
>> I actually intended to close the path with an apostrophe (') after
>> the word "Desktop" , but it seems I forgot it.
>
> You forgot also a slash / after "Desktop". And the syntax of "Save
> To" command is wrong. See the reference.
I knew that something was wrong. I'm learning this (for me) new macro
language slowly, slowly. But I must say all in all it is easier
to learn and more powerful than the old macro language. Unfortunately
the Nisus Macro Reference file does not contain enough examples to
help the novice and illustrate how to use the commands. It's mostly
pure grammar, which can be very frustrating for the beginner.
>
>> The result was that the files and folders I had on the Desktop
>> suddenly all disappeared and the Desktop folder itself is now a
>> Nisus document
>
> I don't know what happened.
I had two documents open, A and B. The macro commands were in A and I
was trying to save document B using the command "Run Selection As
Macro" from the Macro menu. Nisus saved document B with the title
"Desktop" and placed it where the old Desktop folder was, thus
replacing the original Desktop folder. Since the Desktop folder was
replaced (or deleted) all the files and subfolders in it were deleted
too. "This is what happens when you don't know what you are doing", I
told myself. But considering the fact that this was a major
catastrophe for me I would say that this should not have been able to
happen. I sent a report to Manfred and asked him: "Would it be
possible to write a code in NWP that would somehow protect the
Desktop folder from being accidentally replaced, removed or deleted
with a macro? I guess NWP is also able to play havoc with other
important folders as well (the Home folder, the Library
), perhaps
they should be protected from accidentally being replaced and turned
into a Nisus document too." Perhaps the Home folder is protected by
the System software, but I am not going to test it, I have had enough
experiments today.
> But, before running a new macro, you should do some testing,
I always try to do that, but today the path was charged with too much
energy so that in the end the whole macro laboratory exploded with a
blast! :-)
Žorvaršur
|