tengwer Posted May 20, 2009 Posted May 20, 2009 I don't know why but i always seem to have trouble with quotes and variables. I have a variable $CurrentCursor which contains the path to the current mouse cursor being used. Rather than the script reading this variable as windows\cursors\mycursor.cur I need it to be read as "windows\cursors\mycursor.cur". I've tried doubling up quotes around the variable but this doesn't work. The part of the script is as follows: $Cursor = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $CurrentCursor) Can anyone help?
Developers Jos Posted May 20, 2009 Developers Posted May 20, 2009 (edited) Are you sure you need those quotes around it or is the path incorrect? anyways: $Cursor = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", '"' & $CurrentCursor & '"') Edited May 20, 2009 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.
Mat Posted May 20, 2009 Posted May 20, 2009 (edited) $Cursor = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", """" & $CurrentCursor & """") Remember: " "" " is a ", I condense it to get """" alternatively use combinations of ' and " $Cursor = DllCall('user32.dll', 'int', 'LoadCursorFromFile', 'str', '"' & $CurrentCursor & '"') ' " ' used here. MDiesel Edit: a close second place. Edited May 20, 2009 by mdiesel AutoIt Project Listing
tengwer Posted May 20, 2009 Author Posted May 20, 2009 Thank you for your help! It turns out the problem wasn't with the quotes but the c:\ was missing from the path. But at least I know now how to use quotes with a variable.
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