Sign in to follow this  
Followers 0
horne

Quotes in quotes

8 posts in this topic

How i can insert quotes in quotes, like here :

#include <IE.au3>
Local $vboxcode = InputBox("Vbox7 downloader", "Enter vbox7 code.", "", " ")
Local $oIE = _IECreate ($vboxcode, 0, 0, 1, 0)
Local $sHTML = _IEBodyReadHTML($oIE)
Local $sExtract2 = StringRegExpReplace($sHTML, ".*<span class="title">.*</span>", "$1")
MsgBox(4096, "Test", $sExtract2, 1)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

horne,

From the Help file:

Strings

Strings are enclosed in double-quotes like "this". If you want a string to actually contain a double-quote use it twice like:

"here is a ""double-quote"" - ok?"

You can also use single-quotes like 'this' and 'here is a ' 'single-quote' ' - ok?'

You can mix quote types to make for easier working and to avoid having to double-up your quotes to get what you want. For example if you want to use a lot of double-quotes in your strings then you should use single-quotes for declaring them:

'This "sentence" contains "lots" of "double-quotes" does it not?'

is much simpler than:

"This ""sentence"" contains ""lots"" of ""double-quotes"" does it not?"

All clear? :)

M23

Edit: 12k! :o

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

How should I write two sets of double quotes in a string?

For example, I want to pass the following to the command line:

"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""

With previous versions of AutoIt, I'm pretty sure the following would work:

RunWait('"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""""')

But now, when adding the "Command Line" column to Task Manager, I can see all four double-quotes passed at the end of the line. Is a double-quote no longer the escape character for a double-quote?

Share this post


Link to post
Share on other sites

the answer is in the post right above yours :/

You can mix quote types to make for easier working and to avoid having to double-up your quotes to get what you want. For example if you want to use a lot of double-quotes in your strings then you should use single-quotes for declaring them:

'This "sentence" contains "lots" of "double-quotes" does it not?'


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I've adopted the standard practice of using single quotes as it makes life easier when using double quotes. Also it's best to start a new topic and not resurrect an old one. Well then again reading the help file would've have been a better option of the two.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Maybe I wasn't clear. I want to pass a *pair* of double quotes to the command line without the first double quote escaping the second. In my example code I used single quotes to enclose the entire string.

Here is my desired string. See the pair of double quotes at the end?

"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""

If I simply surround the string with single quotes, the last double quote is stripped off.

This doesn't work:

RunWait('"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""')

This used to work, but not with the latest version of AutoIt:

RunWait('"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""""')

So I'd like to know what is the 'proper' method of passing consequtive double quotes? I can't find anything in the documentation about it.

Share this post


Link to post
Share on other sites

Ugh. It looks like double quotes no longer escape double quotes when enclosed in single quotes. I should have tried that.

It looks like this was a bug in SciTE (the obfuscator), not AutoIt, and I must have only read the changelog for AutoIt.

"Fixed bug with 2 double Quotes withing a doublequoted string"

http://www.autoitscript.com/autoit3/scite/docs/history.htm

This also affects 2 double quotes withing a single quoted string, and it's definitely a code breaker.

Share this post


Link to post
Share on other sites

That bug fix was for Obfuscator, it has nothing to do with AutoIt's functionality.

Here's the result of that string above when run through a consolewrite

ConsoleWrite('"%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""' & @CRLF)
; This is the result of the above, copied directly from your script
; "%Temp%VirusScanSetupVSE.Exe" /qb PRESERVESETTINGS=""

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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