christina_applegate Posted October 18, 2015 Share Posted October 18, 2015 hey guys,i'm not much of a coder so please bear with me if this seems a little low browwhat 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 autoitbut 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 messageWindows 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 farany help most appreciated christinaA Link to comment Share on other sites More sharing options...
Developers Jos Posted October 18, 2015 Developers Share Posted October 18, 2015 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 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 More sharing options...
christina_applegate Posted October 18, 2015 Author Share Posted October 18, 2015 hey Jostried;$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.sfchtreturns the correct path? Link to comment Share on other sites More sharing options...
jguinch Posted October 18, 2015 Share Posted October 18, 2015 Check if the string is correct. What does this code returns ?$Name1=ClipGet() MsgBox(0, "", FileExists("C:\Users\frank\Documents\SFiles\C\" & $Name1 & ".sfcht") ) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
christina_applegate Posted October 18, 2015 Author Share Posted October 18, 2015 hi jguinch,thanks for your timeMsgBox returns; 0when 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; 1christinaA Link to comment Share on other sites More sharing options...
philkryder Posted October 19, 2015 Share Posted October 19, 2015 try this: msgbox(0,"",">" & Name1 & "<") Link to comment Share on other sites More sharing options...
christina_applegate Posted October 20, 2015 Author Share Posted October 20, 2015 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 Link to comment Share on other sites More sharing options...
MuffinMan Posted October 20, 2015 Share Posted October 20, 2015 Run StringStripWS on $Name1 and I think you'll be in business... https://www.autoitscript.com/autoit3/docs/functions/StringStripWS.htm Link to comment Share on other sites More sharing options...
JohnOne Posted October 20, 2015 Share Posted October 20, 2015 Does this work?ClipPut("New York Mets") $Name1=ClipGet() ShellExecute("C:\Users\frank\Documents\SFiles\C\" & $Name1 & ".sfcht") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2015 Developers Share Posted October 20, 2015 (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<christinaAThis seems to indicate that there is a CR / LF or CRLF added to the end of the text.Try stripping those.Jos Edited October 20, 2015 by Jos 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 More sharing options...
christina_applegate Posted October 26, 2015 Author Share Posted October 26, 2015 thank you MuffinMan,$Name1=ClipGet() $Name2=StringStripWS($Name1, 1+2+4) ShellExecute("C:\Users\frank\Documents\SFiles\C\" & $Name2 & ".sfcht")Works perfectlymany thankschristinaA Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now