Sign in to follow this  
Followers 0
tengwer

quotes and variables

4 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Jos

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

#3 ·  Posted (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 by mdiesel

Share this post


Link to post
Share on other sites

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.

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