Hello,
Is it possible to add a 'variable' to the MacExec() command?
What I want is the following:
From my program I want to run a .sh file to make directories and move files.
So I want to use the next command: MacExec( "terminal" MoveFilesLite.sh )
HB_FUNC( MACEXEC )
{
NSWorkspace * workspace;
if( hb_pcount() > 1 )
{
workspace = [ [ [ NSWorkspace alloc ] init ] autorelease ];
if( hb_pcount() == 1 )
hb_retl( [ workspace launchapplication: hb_NSSTRING( 1 ) ] );
if( hb_pcount() == 2 )
{
NSURL * url = [ NSURL fileURLWithPath: [ workspace fullPathForApplication: hb_NSSTRING( 1 ) ] ];
NSArray * arguments = [ NSArray arrayWithObjects: hb_NSSTRING( 2 ), nil ];
NSError * error = nil;
hb_retl( [ workspace launchApplicationAtURL:url options:0
configuration:[NSDictionary dictionaryWithObject:arguments forKey:NSWorkspaceLaunchConfigurationArguments]
error:error ] );
}
}
}
HB_FUNC( MACEXEC )
{
NSWorkspace * workspace;
if( hb_pcount() > 1 )
{
workspace = [ [ [ NSWorkspace alloc ] init ] autorelease ];
if( hb_pcount() == 1 )
hb_retl( [ workspace launchapplication: hb_NSSTRING_par( 1 ) ] );
if( hb_pcount() == 2 )
{
NSURL * url = [ NSURL fileURLWithPath: [ workspace fullPathForApplication: hb_NSSTRING_par( 1 ) ] ];
NSArray * arguments = [ NSArray arrayWithObjects: hb_NSSTRING_par( 2 ), nil ];
NSError * error = nil;
hb_retl( [ workspace launchApplicationAtURL:url options:0
configuration:[NSDictionary dictionaryWithObject:arguments forKey:NSWorkspaceLaunchConfigurationArguments]
error:error ] );
}
}
}
# date: 14-03-2017
# to place all needed databases and other files in the right folder
# first make the folders needed
mkdir /Users/$USER/plantenkennis
mkdir /Users/$USER/plantenkennis/databases
mkdir /Users/$USER/plantenkennis/databases/etiketten
mkdir /Users/$USER/plantenkennis/databases/lijsten
mkdir /Users/$USER/plantenkennis/foto
mkdir /Users/$USER/plantenkennis/fotocomb
mkdir /Users/$USER/plantenkennis/iconen
mkdir /Users/$USER/plantenkennis/temp
# now move the files from users/shared/plantenkennisLite naar /users/$user/Plantenkennis
mv /Users/shared/PlantenkennisLite/databases/*.dbf /Users/$USER/plantenkennis/databases
mv /Users/shared/PlantenkennisLite/databases/*.dbt /Users/$USER/plantenkennis/databases
mv /Users/shared/PlantenkennisLite/etiketten/*.* /Users/$USER/plantenkennis/databases/etiketten
mv /Users/shared/PlantenkennisLite/lijsten/*.* /Users/$USER/plantenkennis/databases/lijsten
mv /Users/shared/PlantenkennisLite/foto/*.jpg /Users/$USER/plantenkennis/foto
mv /Users/shared/PlantenkennisLite/iconen/*.* /Users/$USER/plantenkennis/iconen
# I wanted to delete the empty folders, but that does not work?
# rmdir /Users/shared/plantenkennisLite/databases
# rmdir /Users/shared/plantenkennisLite/etiketten
# rmdir /Users/shared/plantenkennisLite/lijsten
# rmdir /Users/shared/plantenkennisLite/foto
# rmdir /Users/shared/plantenkennisLite/fotocomb
# rmdir /Users/shared/plantenkennisLite/iconen
# rmdir /Users/shared/plantenkennisLite
Return to FiveMac / FivePhone (iPhone, iPad)
Users browsing this forum: No registered users and 11 guests