Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently January 9th, 2025, 9:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Inserting quotes into variables.
PostPosted: February 11th, 2009, 12:50 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Hi, is there a way I can assign double quotes within a variable's string?
This is what I'd like to do:

MY_VARIABLE = "/K "MD TEST&&CD TEST""

I'd like to be able to pass a string to a button which launches CMD.EXE,
the gotcha is if you want to process more than one command they have to be seperated by && and enclosed in quotes.

I have successfully tested the operation using the 'option/parameter' when launching the file, but would like to assign the parameter to a variable so I can keep the parameters all in one script together.

I think I need a way of 'escaping' the quotes, but not sure how to progress this in Opus.

Hope this makes sense!

Many thanks, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: February 11th, 2009, 1:01 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Kurt,

Not sure I follow but I'd guess that the string you want stored in the variable would be:

MY_VARIABLE = '/K "MD TEST&&CD TEST"'

Which would use everything minus the outside single quotes.

FYI escapes in Opus are the same as JS. Using a backslash (\) followed by either single (') or double (") quotes. You can also use the hexadecimal value (u0022) or (u0027).

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 11th, 2009, 1:09 pm 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Wow, thanks Mackavi, I didn't realise I could assign a string to a variable in single quotes, tested it and it works fine!

I'm creating an app for a user which uses batch files, but I'm creating the contents of the batch file within Opus so it's neater.

Thanks for the quick response.

Regards, Kurt

_________________
Opus Pro 7.04
Windows XP SP3
2GB
Athlon II X2 1.6GHz
ATI RAdeon HD 3200


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: February 11th, 2009, 4:32 pm 
Offline

Joined: January 19th, 2005, 5:15 pm
Posts: 83
Location: Netherlands
You can use special characters using the backslash in a string:

That would make: MY_VARIABLE = "/K \"MD TEST&&CD TEST\""

It also works with \t = tab, \n = newline, etc.


For this message Reemski has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group