Ok, I have the code below, which is mean't to open a terminal and run a command:
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'osascript -e ''tell app "Terminal" do script "echo hello" end tell'''].
The problem is that Squeak thinks "Terminal" and "echo hello" are comments. How can I escape the double quotes or is there another way to run the AppleScript without double quotes?
Offline
'something''s bothering me'
works for single-quotes; will that work, or do you need double quotes specifically?
Offline
Hardmath123 wrote:
Code:
'something''s bothering me'works for single-quotes; will that work, or do you need double quotes specifically?
I need double quotes because I already have single quotes around it:
''tell app "Terminal" do script "echo hello" end tell''
I had to escape the single quotes around it so I can put it inside a string. If there is a way to escape single quotes, there must be a way to use double quotes.
Offline
BUMP! I think there is a way to store a double quote in a string maybe by using the ASCII code 34, but I still can't figure out how to get that to work.
Offline
'"' (single-double-single) usually works in Squeak and doesn't get recognised as comment.
It's weird that you're not getting it to work, but you can try concatenating them:
'stuff' , '"' , 'more stuff'
Otherwise Character value: 34 will work too.
Offline
Double quotes shouldn't be interpreted as comments it they're within string quotes. I checked just to be sure. :\ You're situation seems rather strange. Have you tested it? Sorry, I have to ask just in case, because this does seem rather strange.
Offline
It works perfectly. This is not a URL:
osascript -e 'tell app "Terminal" do script "echo hello" end tell'
Maybe you could try something like CommandShell?
Last edited by nXIII (2013-01-12 23:54:37)
Offline
nXIII wrote:
http://i47.tinypic.com/2ir2q80.jpg
It works perfectly. This is not a URL:Code:
osascript -e ''tell app "Terminal" do script "echo hello" end tell'Maybe you could try something like CommandShell?
I know it is not an external URL, but you should be able to run programs with it too. CommandShell was actually the first thing I tried, but I don't know how to install it.
Offline
I do realise now that double quotes can be used in strings. I need to install CommandShell in my Scratch mod, but I am sure Squeak 3.8, which is what Scratch uses (I think) doesn't have the required tools to install .sar packages.
Offline
BUMP... Someone please help. I spent all day and night trying to figure this out and still can't get it to work! I know there is someone smart enough here to help me install CommandShell...
Offline
nathanprocks wrote:
BUMP... Someone please help. I spent all day and night trying to figure this out and still can't get it to work! I know there is someone smart enough here to help me install CommandShell...
alright... I'll help you. Probably tomorrow, though. I'm a bit busy now.
Offline
Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.
Last edited by nathanprocks (2013-01-15 01:39:49)
Offline
nathanprocks wrote:
Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.
well, I tried installing the patch to let you import the file required to install CommandShell but there was a problem. It seems that it only works with newer versions of Squeak. This is the same reason I'm having trouble with my Sky3D mod. I'm thinking of implementing scratch in the newest squeak environment.
Offline
dreamod wrote:
nathanprocks wrote:
Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.well, I tried installing the patch to let you import the file required to install CommandShell but there was a problem. It seems that it only works with newer versions of Squeak. This is the same reason I'm having trouble with my Sky3D mod. I'm thinking of implementing scratch in the newest squeak environment.
If you manage to do that, it would be great if you could release it.
I have an idea... I have a load of spare time these holidays. Do you think it would be as simple as filing in all the code from Scratch into the latest version of Squeak, or would it require lots of modification to work, because this would be really good for future Scratch modifications!
Offline
nathanprocks wrote:
dreamod wrote:
nathanprocks wrote:
Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.well, I tried installing the patch to let you import the file required to install CommandShell but there was a problem. It seems that it only works with newer versions of Squeak. This is the same reason I'm having trouble with my Sky3D mod. I'm thinking of implementing scratch in the newest squeak environment.
If you manage to do that, it would be great if you could release it.
I have an idea... I have a load of spare time these holidays. Do you think it would be as simple as filing in all the code from Scratch into the latest version of Squeak, or would it require lots of modification to work, because this would be really good for future Scratch modifications!
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
Offline
dreamod wrote:
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
Syntax highlighting!
Offline
dreamod wrote:
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
I'm not an expert at Squeak, so I probably can't do this myself, but I believe you can do it!
nXIII wrote:
Syntax highlighting!
syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].
Last edited by nathanprocks (2013-01-15 20:35:25)
Offline
nathanprocks wrote:
dreamod wrote:
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
I'm not an expert at Squeak, so I probably can't do this myself, but I believe you can do it!
nXIII wrote:
Syntax highlighting!
syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].
Yes, that is an advantage
Offline
dreamod wrote:
nathanprocks wrote:
dreamod wrote:
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
I'm not an expert at Squeak, so I probably can't do this myself, but I believe you can do it!
nXIII wrote:
Syntax highlighting!
syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].
Yes, that is an advantage
So do you have the time to do it?... I'm guessing you don't because you have a lot of other stuff to do.
Offline
nathanprocks wrote:
dreamod wrote:
nathanprocks wrote:
dreamod wrote:
Well, that's the problem. Some of the most essential classes are modified for example, StringMorph, ScrollBar, StrikeFont and quite a few more I believe. So, the code has to be modified to work with these changes. But I'd need a lot of time to do this, and I'd probably have to do it one class at a time, starting with the Scratch-UI Support classes, which are essential for ScratchPanes and more. But, it would be a very rewarding project.
I'm not an expert at Squeak, so I probably can't do this myself, but I believe you can do it!
syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].Yes, that is an advantage
So do you have the time to do it?... I'm guessing you don't because you have a lot of other stuff to do.
Well, I'll stop working on all my other projects (squeak projects) , and focus on this entirely. Now, I do a lot of other stuff in my free time but I hope to find some time for this project. I'll start prioritizing this project now. But everybody's going to have to be patient
Offline
dreamod wrote:
nathanprocks wrote:
dreamod wrote:
Yes, that is an advantageSo do you have the time to do it?... I'm guessing you don't because you have a lot of other stuff to do.
Well, I'll stop working on all my other projects (squeak projects) , and focus on this entirely. Now, I do a lot of other stuff in my free time but I hope to find some time for this project. I'll start prioritizing this project now. But everybody's going to have to be patient
As long as this will help with your Sky3D mod, I don't feel bad for giving you a load of work to do. xD
Offline
nathanprocks wrote:
dreamod wrote:
nathanprocks wrote:
So do you have the time to do it?... I'm guessing you don't because you have a lot of other stuff to do.Well, I'll stop working on all my other projects (squeak projects) , and focus on this entirely. Now, I do a lot of other stuff in my free time but I hope to find some time for this project. I'll start prioritizing this project now. But everybody's going to have to be patient
As long as this will help with your Sky3D mod, I don't feel bad for giving you a load of work to do. xD
Of course. It will also help lots of other people too, I think.
Offline
dreamod wrote:
nathanprocks wrote:
dreamod wrote:
Well, I'll stop working on all my other projects (squeak projects) , and focus on this entirely. Now, I do a lot of other stuff in my free time but I hope to find some time for this project. I'll start prioritizing this project now. But everybody's going to have to be patient
As long as this will help with your Sky3D mod, I don't feel bad for giving you a load of work to do. xD
Of course. It will also help lots of other people too, I think.
Yeah. I just can't think of any ideas it could be used for other than Sky3D or my mod.
Actually, I have a great idea... A scratch mod that can converts the project into C++ code and compiles it with GCC!
C++ = Fast and cross-platform.
Last edited by nathanprocks (2013-01-16 09:40:52)
Offline
nathanprocks wrote:
dreamod wrote:
nathanprocks wrote:
As long as this will help with your Sky3D mod, I don't feel bad for giving you a load of work to do. xDOf course. It will also help lots of other people too, I think.
Yeah. I just can't think of any ideas it could be used for other than Sky3D or my mod.
Actually, I have a great idea... A scratch mod that can converts the project into C++ code and compiles it with GCC!
C++ = Fast and cross-platform.
the new Squeak has built-in applescript, there's a version with 3D, and there's some objective c class thing that I haven't quite figured out how to use.
Offline
nathanprocks wrote:
Ok, I have the code below, which is mean't to open a terminal and run a command:
Code:
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'osascript -e ''tell app "Terminal" do script "echo hello" end tell'''].The problem is that Squeak thinks "Terminal" and "echo hello" are comments. How can I escape the double quotes or is there another way to run the AppleScript without double quotes?
Mean't? That would mean "mean not" which is obviously not what your trying to say.
Offline