open a file using the shell on Mac OSX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

open a file using the shell on Mac OSX

Rob Vens-2
How can I do this? On Windows this worked:

| response |
    response := ExternalProcess defaultClass shOne: 'cmd /x /c start '
                        , self model value document location asURI asString.
    Transcript
        cr;
        show: response.
    response isEmpty
        ifFalse: [Dialog warn: 'File does not exist or could not be opened']

On the Mac nothing happens though. Is there a way to make this also work on Macintosh?
Reply | Threaded
Open this post in threaded view
|

Re: open a file using the shell on Mac OSX

Karsten Kusche
on OS X there's the 'open' command, it'll open the document/url that was
passed as argument. You can also specify the application that is used to
open the document by adding the -a option.

Kind Regards
Karsten



Rob Vens wrote:

> How can I do this? On Windows this worked:
>
> | response |
>     response := ExternalProcess defaultClass shOne: 'cmd /x /c start '
>                         , self model value document location asURI
> asString.
>     Transcript
>         cr;
>         show: response.
>     response isEmpty
>         ifFalse: [Dialog warn: 'File does not exist or could not be
> opened']
>
> On the Mac nothing happens though. Is there a way to make this also
> work on Macintosh?

--
Karsten Kusche - Dipl.Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

Reply | Threaded
Open this post in threaded view
|

Re: open a file using the shell on Mac OSX

Rob Vens-2
Hah - my hope for a platform independent solution to open files in the OS is in vain apparently.

2007/10/4, Karsten <[hidden email]>:
on OS X there's the 'open' command, it'll open the document/url that was
passed as argument. You can also specify the application that is used to
open the document by adding the -a option.

Kind Regards
Karsten



Rob Vens wrote:

> How can I do this? On Windows this worked:
>
> | response |
>     response := ExternalProcess defaultClass shOne: 'cmd /x /c start '
>                         , self model value document location asURI
> asString.
>     Transcript
>         cr;
>         show: response.
>     response isEmpty
>         ifFalse: [Dialog warn: 'File does not exist or could not be
> opened']
>
> On the Mac nothing happens though. Is there a way to make this also
> work on Macintosh?

--
Karsten Kusche - Dipl.Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812


Reply | Threaded
Open this post in threaded view
|

Re: open a file using the shell on Mac OSX

Andre Schnoor
Rob, you could use

        OSSystemSupport concreteClass new
            openShellDocument: aFilename

and implement #openShellDocument: for the various OS external interfaces. These are mostly three-liners, except for Windows.

Andre

--
Rob Vens schrieb:
Hah - my hope for a platform independent solution to open files in the OS is in vain apparently.

2007/10/4, Karsten <[hidden email]>:
on OS X there's the 'open' command, it'll open the document/url that was
passed as argument. You can also specify the application that is used to
open the document by adding the -a option.

Kind Regards
Karsten



Rob Vens wrote:
> How can I do this? On Windows this worked:
>
> | response |
>     response := ExternalProcess defaultClass shOne: 'cmd /x /c start '
>                         , self model value document location asURI
> asString.
>     Transcript
>         cr;
>         show: response.
>     response isEmpty
>         ifFalse: [Dialog warn: 'File does not exist or could not be
> opened']
>
> On the Mac nothing happens though. Is there a way to make this also
> work on Macintosh?

--
Karsten Kusche - Dipl.Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812


Reply | Threaded
Open this post in threaded view
|

[VWNC 7.5] Table, TableAdaptor etc.

Mike Bielser
In reply to this post by Rob Vens-2
Hi
I'm trying to get a table view to work. I'm using a TableAdaptor and a RowAdaptor, so the simple
examples using TwoDList didn't help me much and I have searched/browsed the archives to no avail.
So far, the initial (empty) table displays correctly (using the aspect "myTable"):

^myTable isNil
        ifTrue:
                [myTable := self emptyTable]
        ifFalse:
                [myTable]

emptyTable
        | matrix row adaptor |

        matrix := OrderedCollection new.
        (1 to: 16) do:
                [:i |
                row := OrderedCollection new.
                (1 to: 16) do:
                        [:j | row add: ''].
                        matrix add: row].
        adaptor := TableAdaptor on: matrix adaptors: (RowAdaptor adaptForIndexes: (1 to: 16)).
        ^TableInterface new selectionInTable: (SelectionInTable with: adaptor)

Now I would like to change the table dynamically (different size and different cell contents).
Unfortunately, that does not work at all (I get a "blank canvas", not even an empty table):

updateMyTable
        | dim matrix row int |

        dim := self resizeMyTable
        matrix := OrderedCollection new.
        (1 to: dim x) do:
                [:i |
                row := OrderedCollection new.
                (1 to: dim y) do:
                        [:j | int := ((i-1)* dim y)+j.
                        row add: int].
                matrix add: row].
myTable selectionInTable table baseCollection: matrix adaptors: (RowAdaptor adaptForIndexes: (1 to:
dim y)).
myTable selectionInTable selectionIndexHolder onChangeSend: #changedCellSelection to: self.
myTable updateLayout.

Does anybody please have any hints or tips? The strange thing is (well, strange to me) that when
debugging and inspecting the table, it's there and everything looks OK (dimensions of the table,
cell entries). So I guess it's some updating/model/display/dependent problem?

Thanks a lot for any help
Mike



Reply | Threaded
Open this post in threaded view
|

Re: open a file using the shell on Mac OSX

Karsten Kusche
In reply to this post by Rob Vens-2
Hi Rob,

you can also try the ExternalWebBrowser package from the cincom store.
it'll probably do exactly what you want.

the usage is fairly simple: ExternalWebBrowser open: 'file:///c:\myFile.txt'
or on a Mac: ExternalWebBrowser open: 'file:///myFile.txt'

both solutions will open the file 'myFile.txt' in the root folder of the
boot-device.

Kind Regards
Karsten



Rob Vens wrote:

> Hah - my hope for a platform independent solution to open files in the
> OS is in vain apparently.
>
> 2007/10/4, Karsten < [hidden email] <mailto:[hidden email]>>:
>
>     on OS X there's the 'open' command, it'll open the document/url
>     that was
>     passed as argument. You can also specify the application that is
>     used to
>     open the document by adding the -a option.
>
>     Kind Regards
>     Karsten
>
>
>
>     Rob Vens wrote:
>     > How can I do this? On Windows this worked:
>     >
>     > | response |
>     >     response := ExternalProcess defaultClass shOne: 'cmd /x /c
>     start '
>     >                         , self model value document location asURI
>     > asString.
>     >     Transcript
>     >         cr;
>     >         show: response.
>     >     response isEmpty
>     >         ifFalse: [Dialog warn: 'File does not exist or could not be
>     > opened']
>     >
>     > On the Mac nothing happens though. Is there a way to make this also
>     > work on Macintosh?
>
>     --
>     Karsten Kusche - Dipl.Inf. - [hidden email] <mailto:[hidden email]>
>     Georg Heeg eK - Köthen
>     Handelsregister: Amtsgericht Dortmund A 12812
>
>

--
Karsten Kusche - Dipl.Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812