This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-11 20:49:35

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Installing CommandShell in Scratch

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?


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#2 2013-01-11 23:15:27

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Installing CommandShell in Scratch

Code:

'something''s bothering me'

works for single-quotes; will that work, or do you need double quotes specifically?


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#3 2013-01-12 00:02:54

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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:

Code:

''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.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#4 2013-01-12 05:26:04

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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.


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#5 2013-01-12 12:26:55

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Installing CommandShell in Scratch

'"' (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

 

#6 2013-01-12 12:40:32

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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

 

#7 2013-01-12 12:47:34

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Installing CommandShell in Scratch

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?

Last edited by nXIII (2013-01-12 23:54:37)


nXIII

Offline

 

#8 2013-01-12 22:48:22

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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.  hmm


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#9 2013-01-13 04:17:45

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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.  sad


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#10 2013-01-13 09:49:48

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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...


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#11 2013-01-13 10:10:04

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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

 

#12 2013-01-15 01:38:32

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.  tongue

Last edited by nathanprocks (2013-01-15 01:39:49)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#13 2013-01-15 09:50:09

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

nathanprocks wrote:

Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.  tongue

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

 

#14 2013-01-15 09:59:09

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

dreamod wrote:

nathanprocks wrote:

Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.  tongue

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!


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#15 2013-01-15 10:18:01

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

nathanprocks wrote:

dreamod wrote:

nathanprocks wrote:

Bump!
Lol I only just noticed that the Scratch Forums automatically remove unnecessary upper case letters.  tongue

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

 

#16 2013-01-15 18:07:37

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Installing CommandShell in Scratch

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!  big_smile


nXIII

Offline

 

#17 2013-01-15 20:35:07

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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!   big_smile

syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].

Last edited by nathanprocks (2013-01-15 20:35:25)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#18 2013-01-16 08:38:00

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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!   big_smile

syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].

Yes, that is an advantage  smile

Offline

 

#19 2013-01-16 08:46:00

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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!   big_smile

syntaxHighlighting ifTrue: [DialogBoxMorph inform: 'Syntax highlighting FTW!!!'].

Yes, that is an advantage  smile

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.  tongue


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#20 2013-01-16 09:07:15

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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  smile

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.  tongue

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  smile

Offline

 

#21 2013-01-16 09:12:14

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

dreamod wrote:

nathanprocks wrote:

dreamod wrote:


Yes, that is an advantage  smile

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.  tongue

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  smile

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


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#22 2013-01-16 09:25:31

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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.  tongue

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  smile

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

 

#23 2013-01-16 09:40:09

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: Installing CommandShell in Scratch

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  smile

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)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#24 2013-01-16 11:22:26

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Installing CommandShell in Scratch

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. 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.

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

 

#25 2013-01-16 11:39:44

sccar3
Scratcher
Registered: 2008-09-04
Posts: 100+

Re: Installing CommandShell in Scratch

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.


http://1.bp.blogspot.com/-WInb2DZ2LBM/UQaLETx3VII/AAAAAAAAAmQ/ZOpSwEPggiE/s1600/The%2BElder%2BScrolls%2BOnline%2BSignup%2BBeta.jpg

Offline

 

Board footer