43
Mac OSにおけるShellコマンドの活 2014 Xojo 東京勉強会 (1/25) 野 純( [email protected] ) 14126日日曜日

Mac OSにおけるShellコマンドの活⽤用 (Xojo 勉強会)

  • Upload
    -

  • View
    2.260

  • Download
    7

Embed Size (px)

Citation preview

  • Mac OSShell

    2014 Xojo (1/25)

    ( [email protected] )

    14126

  • About @junnama

    ( a.k.a. junnama ) (Web)Movable Type Perl, PHP, JavaScript...

    14126

  • XojoY

    14126

  • 14126

  • ?

    Xojo()

    14126

  • 7Declare Plugin

    Xojo()

    14126

  • Mac OSShell

    14126

  • Mac OS = Unix

    14126

  • Dim Sh As New ShellSh.Execute( "ls" )MsgBox( Sh.ReadAll )

    14126

  • http://junnama.alfasado.net/online/2013/12/mac_os_x.html

    14126

    http://junnama.alfasado.net/online/2013/12/mac_os_x.htmlhttp://junnama.alfasado.net/online/2013/12/mac_os_x.html

  • screencapture

    14126

  • screencapture foo.pngscreencapture -R 117,226,100,100screencapture -t pdf foo.pdf

    screencapture

    14126

  • 14126

  • Canvas (Color)

    screencapture + Xojo

    14126

  • say

    14126

  • 14126

  • say Hello World

    say

    14126

  • 14126

  • mdfind

    14126

  • mdfind -onlyin /Applications/ 'kMDItemContentTypeTree=="com.apple.application"

    mdfind

    14126

  • mdfind

    mdfind + Xojo

    14126

  • 14126

  • Dim d As Date = New DateDim hex As StringDim bytes As Stringbytes = MD5( Str( round( rnd * 3000 ) + 1 ) )Dim hex As String = EncodeHex( bytes )F = F.Child( "dragitem-" + hex +"-"F = F + Format( d.TotalSeconds, "#") + ".abcd" )FS = BinaryStream.Create( F, true )FS.closeF.visible = FalseDim di As DragItemDraggingItem = F.Name

    mdfind

    14126

  • di = New DragItem (self,System.MouseX,System.MouseY-Main.Top,64, 64)di.FolderItem = Fdi.DragWatchFile.Mode = Timer.ModeMultipleReturn False

    mdfind

    Dim Command As String = "mdfind -name " + DraggingItemDim Sh As New ShellSh.Execute( Command )Dim Res As String = Sh.ReadAllif Res "" Then F = GetFolderItem( Res ) ...

    14126

  • qlmanage

    14126

  • qlmanage

    qlmanage -p foo.png

    14126

  • qlmanage + Xojo

    14126

  • 14126

  • Perl

    14126

  • Mac OS = Unix

    14126

  • Perl, PHP, Ruby, Python...

    14126

  • 14126

  • my $StorageClient = Net::Azure::StorageClient->new( type => 'Blob', account_name => $you_account_name, primary_access_key => $your_primary_access_key, protocol => 'https', api_version => '2012-02-12' );my $res = $StorageClient->get( $url );print $res->content;

    14126

  • use strict;use lib qw( lib );use Getopt::Long qw/:config posix_default no_ignore_case bundling auto_help/;...

    14126

  • GetOptions(\my %options, qw/ account=s accesskey=s path=s action=s acl=s file=s get_all=i thread=i metadata=s pass=s proc=s/);

    14126

  • cd path/to/app; perl app.pl --action=get --path https://foo.blob....

    14126

  • Application = Folder

    14126

  • 14126

  • 14126

  • Dim AppName As String = CurrentBuildAppNameAppName = ReplaceAll( AppName, " ", "\ " ) Dim AppPath As StringAppPath = CurrentBuildLocation + "/" + AppName + ".app"Dim Command As Stringcommand = "cp /path/to/src.zip " + AppPath + "/Contents/MacOS/src.zip"Call DoShellCommand( Command )command = "cd " + AppPath + "/Contents/MacOS; unzip src.zip"Call DoShellCommand( Command )command = "cd " + AppPath + "/Contents/MacOS; rm src.zip"Call DoShellCommand( Command )

    14126

  • cd path/to/app;

    14126

  • Dim App as new applicationDim MyApp As FolderItemMyApp = App.ExecutableFileDim Name As String = MyApp.Name + ".app"MyApp = GetFolderItem( MyApp.NativePath,3 ).ParentDim CMD As String = cd + MyApp.ShellPath + ;CMD = CMD + perl src/app.pl --account CMD = CMD + EscapeShell ( Account )CMD = CMD + --token + EscapeShell( Token )CMS = CMD + --action put --path + EscapeShell( Path )CMS = CMD + --file + EscapeShell( File.ShellPath )

    14126

  • cd path/to/MyApp/Contents/MacOS;perl ./app.pl --action=get --path https://foo.blob....

    14126