christina_applegate Posted October 18, 2015 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
Developers Jos Posted October 18, 2015 Developers 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.
christina_applegate Posted October 18, 2015 Author 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?
jguinch Posted October 18, 2015 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") ) Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
christina_applegate Posted October 18, 2015 Author 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
christina_applegate Posted October 20, 2015 Author 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
MuffinMan Posted October 20, 2015 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
JohnOne Posted October 20, 2015 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.
Developers Jos Posted October 20, 2015 Developers Posted October 20, 2015 (edited) On 10/20/2015 at 6:51 PM, christina_applegate said: 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.
christina_applegate Posted October 26, 2015 Author 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
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