Cut everything except between "Quotes"

Hi Folks,

Using Scripting Additions I am able to connect do my modem and send ATCommands to the device!

this script works pretty fine - alltough I kindly ask you to help me solving this:

serialport list

shows the connected devices

set portRef to serialport open "/dev/cu.HUAWEIMobile-Modem"
if portRef is equal to -1 then
display dialog "Could not connect to port"
delay 1
set xstr to "at+cops?" & return
serialport write xstr to portRef
delay 1
set show to serialport read portRef for 35 --shows 35 digits
display dialog show
serialport close portRef
end if

The Output is now:

+cops: 0,0,“T-Mobile A”,


How can I cut out everything in this variable xstr exept “T-Mobile A”

Thanks for your help!

Best Regards,


By ‘Output’ do you mean how ‘show’ presents in your dialog?

Hi Adam,

sorry - Yes this is correct!

Thanks for your help and your time!

Best regards,


set show to "at+cops?
+cops: 0,0,\"T-Mobile A\"," -- quotes escaped because they are inside quotes
-- this is the part that does it (the line above is to give me something to work with)
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\"" -- again, quotes escaped
set Q to text item 2 of show
set AppleScript's text item delimiters to tid
display dialog Q

Hi Adam,

this works PERFECT!

thousand times “Thanks a lot”

Best Regards,