Sign in to follow this  
Followers 0
Kapz

Simple Question

7 posts in this topic

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

Share this post


Link to post
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.

 

Share this post


Link to post
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.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
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**

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

maybe the last characters contain CRLF ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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?

Share this post


Link to post
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?

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

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

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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! ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0