Unable to build app for Mac OS X, getting error - macos

Iam building the .dmg file using ant script, inturn it uses applescript will peovide below.
Below is the error iam getting.
installer.mac:
[mkdir] Created dir: /Users/damuammu/Desktop/spark-Mac/target/installer
[mkdir] Created dir:
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/.background
[copy] Copying 1 file to
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/.background
[symlink] ln -s /Applications
/Users/damuammu/Desktop/spark-Mac/target/MixTalx_app/Applications
[echo] Create tmp.dmg
[exec] created: /Users/damuammu/Desktop/spark-Mac/target/tmp.dmg
[echo] Attach tmp.dmg
[exec] /dev/disk2 Apple_partition_scheme
[exec] /dev/disk2s1 Apple_partition_map
[exec] /dev/disk2s2 Apple_HFS
/Users/damuammu/Desktop/spark-Mac/target/tmp
[exec] cp:
/Users/damuammu/Desktop/spark-Mac/build/installer/mac/RightDSStore: No
such file or directory
[exec] Result: 1
[exec] mac/dmg_spark.scpt: execution error: Finder got an error:
Can’t set item "Spark.app" of disk "MixTalx_2.6.3" to {140, 250}.
(-10006)
BUILD FAILED
/Users/damuammu/Desktop/spark-Mac/build/build.xml:775: exec returned: 1
Below is the applescript
on run {volumeName, artPath, theHeight, theWidth, x1, y1, x2, y2, iconSize}
tell application "Finder"
tell disk (volumeName as string)
open
delay 2
set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set the bounds to {10, 10, 658, 482}
set statusbar visible to false
end tell
set opts to the icon view options of container window
set the arrangement of opts to not arranged
set the icon size of opts to 128
--iconSize
set background picture of opts to file ".background:dmgBackground.png"
-- Icon positions
delay 2
set position of item "Spark.app" to {140, 250}
set position of item "Applications" to {395, 250}
delay 2
update without registering applications
end tell
delay 10
end tell
end run
Please can anyone suggest on this issue.

The error occurs in your ant script before the AppleScript is run. The error is here:
[exec] cp:
/Users/damuammu/Desktop/spark-Mac/build/installer/mac/RightDSStore: No
such file or directory
What the AppleScript does is make your mounted DMG volume look pretty. Since not everything gets put properly in the DMG, the Applescript later fails with:
[exec] mac/dmg_spark.scpt: execution error: Finder got an error:
Can’t set item "Spark.app" of disk "MixTalx_2.6.3" to {140, 250}.
(-10006)
However, what you need to do is fix the ant script failing with the first error.

Related

Progress Bar in Applescript window

I want to download different apps with a bash script on macOS.
As there are some larger downloads (e.g. Office 365) I would like to include a progress bar in a regular macOS Window.
The applications download+install script looks like this
cd ~/Downloads/ && { curl -O https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg ; cd -; }
sudo hdiutil attach ~/Downloads/googlechrome.dmg
sudo cp -r /Volumes/Google\ Chrome/Google\ Chrome.app /Applications/
diskutil unmount Google\ Chrome
But this does not show any progress for the user (script will run in background).
I found the following example and edited it a bit to my likings
chromedl() {
osascript <<AppleScript
set progress description to "Loading"
set progress additional description to "Please wait"
set progress total steps to 3
repeat with i from 1 to 4
set theSourceCode to do shell script "curl -L -m 30 seconds [url=https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg]https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg]"
set progress completed steps to i
end repeat
display dialog "Progress bar is complete."
AppleScript
But this creates a curl execution error.
Please help me with a functioning Curl Download + Progress Bar script
A basic progress spinner window is easy enough to create using AppleScriptObjectiveC. Copy the following into Script Editor and run it in the foreground (command-control-R, or use the menu command Script→Run in Foreground, which appears when you hold down the control key).
use framework "AppKit"
use AppleScript version "2.4" -- Yosemite 10.10 or later required
use scripting additions
-- convenience properties to make ASOC more readable
property ca : current application
property NSPanel : class "NSPanel"
property NSView : class "NSView"
property NSProgressIndicator : class "NSProgressIndicator"
property NSTextField : class "NSTextField"
property HUD_mask : 8192
property nonactivating_mask : 128
global progress_panel, progress_indicator, label_field
make_progress_panel()
progress_indicator's startAnimation:me
progress_panel's orderFront:me
-- just hang it out there for 5 seconds as proof of concept
delay 5
progress_panel's |close|()
on make_progress_panel()
-- make floating panel
set content_rect to ca's NSMakeRect(200, 800, 140, 80)
set progress_panel to NSPanel's alloc's initWithContentRect:content_rect styleMask:(HUD_mask + nonactivating_mask) backing:(ca's NSBackingStoreBuffered) defer:true
set progress_panel's floatingPanel to true
-- make progress indicator
set progress_rect to ca's NSMakeRect(0, 0, 40, 40)
set progress_indicator to NSProgressIndicator's alloc's initWithFrame:progress_rect
set progress_indicator's indeterminate to true
set progress_indicator's |style| to 1
set progress_indicator's translatesAutoresizingMaskIntoConstraints to false
--make text field
set label_field to NSTextField's labelWithString:"Downloading"
set label_field's translatesAutoresizingMaskIntoConstraints to false
-- make container view, and add subviews
set content_view to NSView's alloc's initWithFrame:content_rect
content_view's addSubview:label_field
content_view's addSubview:progress_indicator
progress_indicator's sizeToFit()
set progress_panel's contentView to content_view
-- view constraints, for alignment
set pi_y_centering to progress_indicator's centerYAnchor's constraintEqualToAnchor:(content_view's centerYAnchor)
set lf_y_centering to label_field's centerYAnchor's constraintEqualToAnchor:(content_view's centerYAnchor)
pi_y_centering's setActive:true
lf_y_centering's setActive:true
set lf_left_margin to content_view's leadingAnchor's constraintEqualToAnchor:(label_field's leadingAnchor) |constant|:-10
lf_left_margin's setActive:true
set pi_left_margin to label_field's trailingAnchor's constraintEqualToAnchor:(progress_indicator's leadingAnchor) |constant|:-10
pi_left_margin's setActive:true
set pi_right_margin to progress_indicator's trailingAnchor's constraintGreaterThanOrEqualToAnchor:(content_view's trailingAnchor) |constant|:10
pi_left_margin's setActive:true
end make_progress_panel
The simplest way to make this work with curl, I think, is to detach the curl process entirely and recover its pid, like so (the code at the end detaches the process and sends the output to oblivion, then returns the pid):
set curl_pid to do shell script "curl -L [url=...] &> /dev/null & echo $!"
Once you have the pid you can set up a loop (or an idle handler, if you create an app) and periodically check to see if the process is still active:
try
set b to do shell script "pgrep curl | grep " & curl_pid
on error
progress_indicator's stopAnimation:me
progress_panel's |close|()
end try
If you want a determinate progress bar, that's easy enough to manage, but you have to figure out a way to measure progress. This link suggests you can get the headers for a file first and extract the file size; you could compare that against the actual on-disk file size as the download progresses, and feed the ratio into the progress bar.

Play custom bundled sound in apple script

So im trying to use shellscript "afplay " in applescript to play an .m4a file I bundled into the app resource. Not entirely sure how it works.
Got this after a bit of searching around,
set soundPath to POSIX path of (path to resource "Sound File.aiff")
do shell script "afplay " & quoted form of soundPath
This isnt really what I want.
playAudio() -- place this Line To call the handler to Play An Audio File.
on playAudio()
set audioFile to path to resource "Sound File.aiff"
set theFile to POSIX path of audioFile
do shell script "afplay -q 1 -t 25 " & " " & quoted form of theFile
end playAudio
-- Command Line OPTIONS For Playing Audio Files
(*
afplay [option...] audio_file
Options: (may appear before or after arguments)
{-v | --volume} VOLUME
set the volume for playback of the file
{-h | --help}
print help
{ --leaks}
run leaks analysis
{-t | --time} TIME
play for TIME seconds
{-r | --rate} RATE
play at playback rate
{-q | --rQuality} QUALITY
set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality)
{-d | --debug}
debug print output
*)

How to Pre fill wise installer Dialog

I am trying to support this legacy application where we use wise installer to create our application installer. I can see that script will take parameters.
What I want is that when user run installer, the install dialog should have values pre-filled. For this I did some research and found that I can put those parameters in a file and then call installer with a tag and parameters file name.
Here is syntax that I tired
MyAppSetup.exe /M="C:\USERS\User1\DOCUMENTS\MyAppSetup.txt"
where MyAppSetup.txt has parameter names and it values. MyAppSetup.txt contents is as below
COMPANY="ABC"
SERIALNUMBER="123"
...
...
Now installer runs correctly, but values are not prefilled.
But if I run the installer in silent mode, it dose uses the parameters correctly.
Here is syntax to run the same script in silent mode.
MyAppSetup.exe /S /M="C:\USERS\User1\DOCUMENTS\MyAppSetup.txt"
I would really appreciate if someone can guide me on how to call installer visually and have values prefilled.
Here are some useful links that I found
What are the command line parameters available for WiseScript?
Wise Setup.exe Switches
Use a .ini file, then the installer will read those values and populate the dialog quite nicely. Here's an example of a C:\MyApp\MyAppSettings.ini:
[settings]
COMPANY=ABC
SERIALNUMBER=123
...and a .wse that will populate a dialog:
item: Set Variable
Variable=MAINDIR
Value=C:\MyApp
end
item: Set Variable
Variable=COMPANY
end
item: Set Variable
Variable=SERIAL
end
item: Read INI Value
Variable=COMPANY
Pathname=%MAINDIR%\MyAppSettings.ini
Section=settings
Item=COMPANY
end
item: Read INI Value
Variable=SERIAL
Pathname=%MAINDIR%\MyAppSettings.ini
Section=settings
Item=SERIALNUMBER
end
item: Custom Dialog Set
Name=My App Settings
item: Dialog
Title=My App Settings
Width=290
Height=238
Font Name=Helv
Font Size=8
item: Static
Rectangle=5 5 105 20
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Company Name
end
item: Editbox
Rectangle=114 7 230 22
Help Context=16711681
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000000000000
Text=%COMPANY%
end
item: Static
Rectangle=5 25 105 40
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000000000000000000000
Text=Serial Number
end
item: Editbox
Rectangle=114 26 230 41
Help Context=16711681
Enabled Color=00000000000000001111111111111111
Create Flags=01010000100000010000000000000000
Text=%SERIAL%
end
item: Push Button
Rectangle=182 145 217 160
Enabled Color=00000000000000001111111111111111
Create Flags=01010000000000010000000000000000
Text=&Next
end
end
end

SoundRecorder.exe Executed from Ruby on Windows 7

I am trying to run c:\windows\system32\soundrecorder.exe on a Windows 7 Device from Ruby. When I run that application, I get the following error: "No such file or Directory".
I can successfully run CALC.exe without any trouble.
I verified that my computer has the following file:
Directory of c:\windows\system32
07/13/2009 08:39 PM 142,336 SoundRecorder.exe
1 File(s) 142,336 bytes
0 Dir(s) 156,940,525,568 bytes free
I'm using:
#run_command = 'c:\windows\system32\SoundRecorder.exe'
stdin, stdout,stderr =Open3.popen3(#run_command) do |stdin,stdout,stderr,wait_thr|
process_pid = wait_thr[:pid]
p "Process Started for Execute Command: #{process_pid}"
exit_status = wait_thr.value
end
Here are the things I tried:
Ran using Calc.exe (for #run_command), and it worked.
Tried to execute this with Root privileges which failed.
Tried to pass in more environment variables which failed.
Tried to execute this via IRB and that failed.
Tried to execute this via ``` (back ticks) which failed.
** Additional Debugging Results ***
irb(main):006:0> Dir.exist? 'c:/windows/system32'
=> true
irb(main):011:0> File.exist? 'c:/windows/system32/calc.exe'
=> true
irb(main):012:0> File.exist? 'c:/windows/system32/SoundRecorder.exe'
=> false
HOWEVER before anyone says, "XXX, the file doesn't exist look here"
C:\>dir c:\windows\system32\SoundRecorder.exe
Volume in drive C is OS
Volume Serial Number is F099-27F4
Directory of c:\windows\system32
07/13/2009 08:39 PM 142,336 SoundRecorder.exe
1 File(s) 142,336 bytes
0 Dir(s) 156,942,340,096 bytes free
This is 100 % a Windows issue.
Copy the file anywhere else, and run that.
It works. I don't know why.

VBS - Error opening connection using ADODB

I'm having problems trying to connect in my oracle database using an ADODB object in VBScript, the code is working on a Win7 machine but not on WinXP, I tried to search for the error code, downloaded the sdk with the help file to look for something but I didn't found nothing useful.
Here is the code sample:
ConnectionString = "DSN=(Oracle in OraClient11g_home1);UID=username ;PWD=password ;DBQ=myDatabase"
Set objCon = CreateObject("ADODB.Connection")
objCon.Open ConnectionString 'the error occurs in this line
I don't know if the connection string must be different for winXP machines... I really don't know how to solve this, can someone help me?
The error trace information:
"Error #-2147024770:
Error reported by: ADODB.Connection
Help File:
Topic ID: 1240640"
-2147024770 = FFFFFFFF8007007E
To Decode 0x8007nnnn Errors
HResults with facility code 7 means the HResult contains a Windows' error code. You have to look up the Windows' error code not the HResult.
To decode 0x8007007e. The 0x means it's a hexadecimal number, the 8 means error, the first 7 means it a windows error, and the rest of the number, 7e, is the actual Windows error.
To look up the error we need it in decimal format. Start Calculator (Start - All Programs - Accessories - Calculator) and choose View menu - Scientific, then View menu - Hex. Enter 7e. Then View menu - Decimal. It will say 126.
Start a Command Prompt (Start - All Programs - Accessories - Command Prompt) and type
net helpmsg 126
and it will say
The specified module could not be found.
or look it up in winerror.h
//
// MessageId: ERROR_MOD_NOT_FOUND
//
// MessageText:
//
// The specified module could not be found.
//
#define ERROR_MOD_NOT_FOUND 126L
To see what is happening start your program in ntsd.
Start a command prompt.
Type
md c:\symbols
set _NT_SYMBOL_PATH=srv*C:\tmp*http://msdl.microsoft.com/download/symbols;c:\symbols
then (changing it to your program from notepad)
ntsd -g -o c:\windows\notepad.exe
so something
ntsd -g -o wscript "c:\folder\script.vbs"
and wait for the error.

Resources