Jump to content

How to assign a ("+{ENTER}") to a variable? Chr( ? )


Guy_
 Share

Recommended Posts

$prefix = @CRLF & $article_Prefix

I have this spot where I define a prefix.

The @CRLF should function as a Shift+Enter (to stay inside a paragraph in WordPad etc.).

Using Send ("+{ENTER}") works correctly, but I can't use that here, can I?

In the code neither @CRLF, @LF or @CR is doing the job.

Do I have to use the Chr ( ASCIIcode ) for this? (but I don't see a code that could be it...)

Tyvm & Happy Newyear! :sorcerer:

Link to comment
Share on other sites

I'm not sure what you mean by stay inside a paragraph, Control + Enter seems to do something. If you are looking for an indent, perhaps @TAB will work.

CODE REMOVED

I'm just guessing though. What's wrong with using two Send commands one after the other?

Edit

I think I'm missing something here. When I format a paragraph in Wordpad, @CTRL @CRLF doesn't alter the indent. Using Shift + Enter doesn't seem to do anything special or different from just pressing Enter. What I said above must be wrong.

Edited by czardas
Link to comment
Share on other sites

It's common in a lot of programs that Shift + Enter has you remain in the same paragraph. In other words, it doesn't truely create a new one, it just puts the cursor to the next line.

Often people have paragraph styles defined where e.g. space would be added between them, font changes, etc. You don't want that when you just want some text in the current parapgraph starting on the next line. With Shift + Enter, you will remain in the current paragraph (formatting).

In my program, at that point I'm in an "internal code" situation where I think I can't use the Send command. I'm concatenating some stuff where I want the Shift + Enter effect to be integrated into the variable.

Is this more clear? :)

I sure hope it exists. These kind of questions never seem to get much response.

Edited by Guy_
Link to comment
Share on other sites

Well if it's intended to be universal for programs other than WordPad then there is no guarantee that the character string will be formatted the same way. What you are doing is sending an accelerator key to a GUI which may behave differently depending on the program. I think probably the best option is to do what I suggested earlier and send each line with two commands. First send the accelerator keys and then the line of text.

If you need to do this multiple times, you could try using an array to store each line separately. Another complication with trying to embed certain formatting instructions within strings is that they may be stored in a separate location to the actual text in some formats such as RTF.

Edited by czardas
Link to comment
Share on other sites

Well if it's intended to be universal for programs other than WordPad

Actually on the contrary. If it would work with WordPad only, I'd still be happy (and it probably would for Word too).

I think probably the best option is to do what I suggested earlier and send each line with two commands. First send the accelerator keys and then the line of text.

Accelerator keys is the Send("+{ENTER}") ...?

BTW, you mention @CTRL in your first message, which I never mentioned. Was that a spelling error or a useful hint? :)

Another complication with trying to embed certain formatting instructions within strings is that they may be stored in a separate location to the actual text in some formats such as RTF.

True, that may be the core problem...

I'll have to find a workaround where I replace a certain dummy code combo with the Send("+{ENTER}") during pasting, I guess...

It will then make it more universal as well.

Thanks for your help! :idiot:

Link to comment
Share on other sites

Accelerator keys is the Send("+{ENTER}") ...?

Yes

@CRLF is a macro used in AutoIt to insert both CR and LF in sequence. Many programs use this combination for line breaks. You could write the whole file in Rich Text Format, but that would mean learning some complicated syntax and it could take you much longer to complete your project, although it might be more suitable and better in the long run. Personally I would experiment with possible the workaround solutions.

Thanks for your help! :idiot:

I'm a bit out of my depth when it comes to RTF, but if something I said helps you then I'm happy about that. :) Thanks! Edited by czardas
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...