Jump to content

Simple Question


Kapz
 Share

Recommended Posts

I have a variable called $var and I want to attach the string ".bmp" to the end of it so that the final string ($var) exists on a single line. As it is now Send($var & ".bmp") it sends the $var and then on the next line it sends .bmp rather than sending it altogether on a single line.

**I know this is simple, but I can't remember what I did last time to fix it**

Link to comment
Share on other sites

works for me

Send("#r")
WinWaitActive("Run")
Send("notepad.exe{Enter}")
WinWaitActive("Untitled -")
Send("Today's time/date is {F5}"  & @LF)
$var = "test"
Send($var & ".bmp")

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I have a variable called $var and I want to attach the string ".bmp" to the end of it so that the final string ($var) exists on a single line. As it is now Send($var & ".bmp") it sends the $var and then on the next line it sends .bmp rather than sending it altogether on a single line.

**I know this is simple, but I can't remember what I did last time to fix it**

This work ok for me.

$var="BigDod"
WinWaitActive("Untitled")
Send($var & ".bmp")

Or am I not understanding properly what you want.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Developers

I have a variable called $var and I want to attach the string ".bmp" to the end of it so that the final string ($var) exists on a single line. As it is now Send($var & ".bmp") it sends the $var and then on the next line it sends .bmp rather than sending it altogether on a single line.

**I know this is simple, but I can't remember what I did last time to fix it**

Think your $var contains more then just some alphanumeric characters.

maybe the last characters contain CRLF ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Wow, quick replies! Actually I am currently doing all of those things, but I'm trying to do a Send($var & ".bmp") to a Save As line....so I hit F12 then shoot the above Send command and it puts the .bmp on the next line.

The $var is what I'm getting from the clipboard which is taken from a single cell in Excel. The words are usually only a few letters long, but I have a feeling that the CTRL+c from each Excel cell is also adding a return space or something at the end of the string which is causing it.

Think your $var contains more then just some alphanumeric characters.

maybe the last characters contain CRLF ?

It could very well contain a CRLF, any way to trim that off so it doesn't skip down to the next line before adding .bmp?

Link to comment
Share on other sites

  • Developers

Wow, quick replies! Actually I am currently doing all of those things, but I'm trying to do a Send($var & ".bmp") to a Save As line....so I hit F12 then shoot the above Send command and it puts the .bmp on the next line.

The $var is what I'm getting from the clipboard which is taken from a single cell in Excel. The words are usually only a few letters long, but I have a feeling that the CTRL+c from each Excel cell is also adding a return space or something at the end of the string which is causing it.

It could very well contain a CRLF, any way to trim that off so it doesn't skip down to the next line before adding .bmp?

This ensures that there are no CR or LF characters in the variable:

$var=Stringreplace($var,@LF,'')

$var=Stringreplace($var,@CR,'')

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Wow, quick replies! Actually I am currently doing all of those things, but I'm trying to do a Send($var & ".bmp") to a Save As line....so I hit F12 then shoot the above Send command and it puts the .bmp on the next line.

The $var is what I'm getting from the clipboard which is taken from a single cell in Excel. The words are usually only a few letters long, but I have a feeling that the CTRL+c from each Excel cell is also adding a return space or something at the end of the string which is causing it.

It could very well contain a CRLF, any way to trim that off so it doesn't skip down to the next line before adding .bmp?

Did you msgbox test it...or try attaching some regular text?

If it seems okay you could just do $var=$var&".bmp"

then do the send.

Otherwise do what's advised above, or use the stringtrim function. Check out the string functions in the help library! ;)

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...