christina_applegate

shellexecute path name variable

11 posts in this topic

hey guys,

i'm not much of a coder so please bear with me if this seems a little low brow

what i am having a problem with is introducing a variable into a shellexecute command that works;

ShellExecute("C:\Users\frank\Documents\SFiles\C\New York Mets.sfcht")

above works fine, file opens and then i am able to manipulate with autoit

but when i attempt to get the 'New York Mets' from the clipboard

$Name1=ClipGet()
ShellExecute("C:\Users\frank\Documents\SFiles\C\" & $Name1 & ".sfcht")

 i get an error message

Windows cannot find 'C:\Users\frank\Documents\SFiles\C\New York Mets.sfcht'. Make sure........

i have been through the forums and the help files but no luck so far

any help most appreciated

 

christinaA

 

Share this post


Link to post
Share on other sites



Doubt the text is exactly the same on the clipboard. Have you checked there are no extra spaces or a Tab char maybe?
Just write the text you retrieve from the clipboard to a file for checking.

Jos


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

Share this post


Link to post
Share on other sites

hey Jos

tried;

$Name1=ClipGet()
$file = "C:\Users\frank\Documents\test.txt"
FileWrite($file, $Name1)

result was 'New York Mets'

also the error message; C:\Users\frank\Documents\SFiles\C\New York Mets.sfcht

returns the correct path?

Share this post


Link to post
Share on other sites

hi jguinch,

thanks for your time

MsgBox returns; 0

when i then copy 'New York Mets' to the clipboard and then paste over

" & $Name1 & "

which gives me

$Name1=ClipGet()
MsgBox(0, "", FileExists("C:\Users\frank\Documents\SFiles\C\New York Mets.sfcht") )

MsgBox returns; 1

christinaA

Share this post


Link to post
Share on other sites

try this: 

msgbox(0,"",">" & Name1 & "<")

 

Share this post


Link to post
Share on other sites

hi philkryder,

i tried your code but had to add $ in front of Name1 as in:

msgbox(0,"",">" & $Name1 & "<")

and the return was:

>New York Mets

<

christinaA

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

hi philkryder,

i tried your code but had to add $ in front of Name1 as in:

msgbox(0,"",">" & $Name1 & "<")

and the return was:

>New York Mets

<

christinaA

This seems to indicate that there is a CR / LF or CRLF added to the end of the text.
Try stripping those.

Jos

Edited by Jos

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

Share this post


Link to post
Share on other sites

thank you MuffinMan,

$Name1=ClipGet()
$Name2=StringStripWS($Name1, 1+2+4)
ShellExecute("C:\Users\frank\Documents\SFiles\C\" & $Name2 & ".sfcht")

Works perfectly

many thanks

christinaA

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