I am trying to implement a Progress bar update in AppleScriptObjC. I have connected the progressbar thru IB and trying to increment the Progressbar update via incrementBy(5). The Inderterminate property is set to false. the IB connection is fine because if I set the Inderterminate to true and uncomemnt the code to start/stop animation it works fine. this is the Error I get "-[NSProgressIndicator incrementby:]: unrecognized selector sent to instance 0x2007e2220"
following is the code
property ProgressBar : missing value
on MyBtnClick_(sender)
(*.. some code ..*)
ProgressBar's incrementby_(5)
ProgressBar's displayifNeeded()
--ProgressBar's startAnimation_(me)
--ProgressBar's stopAnimation_(me)
end MyBtnClick_
Thanks in Adv for any pointers.
regards,
Jesse
Try incrementBy_ -- case matters.
Ok so, "unrecognized selector sent to instance" means that the command sent is unknown so the command your sending to it means it does not exist, however If you are trying to send a message to make the progress bar to set its progress % then, i can help you! :D, I use the "setDoubleValue" command to set the Progress bars status and you don't need to startAnimation and stopAnimation it either :D
ok so here is a script that will store the current progress and when MyBtnClick is run, it will add 5% to the progress bar
property ProgressBar : missing value
property currentProgress : 0
on MyBtnClick_(sender)
(*.. some code ..*)
set currentProgress to currentProgress + 5
ProgressBar's setDoubleValue_(currentProgress)
end MyBtnClick_
hope this helps :D
Related
I'm getting an error as such:
E 0:00:00.744 _animation_update_transforms: Failed setting key at
time 0 in Animation 'Running' at Node '/path/to/AnimationPlayer',
Track 'path/to/custom node:rotation_degrees'.
Check if property exists or the type of key is right for the property
<C++ Source> scene/animation/animation_player.cpp:871 #
_animation_update_transforms()
I'm trying to rotate a custom node (made by extending position2D) in animation but for some reason this error shows up.
According to the error:
Check if property exists
since I've extended position2D the rotation property exists
and the other part:
type of key is right for the property
I believe the values for the key are accurate, as when I hover over the keys
all the values seem to be accurate:
How do I fix this error?
or anyway to further isolate the error to pinpoint exactly where it's occurring within my custom node script?
if you are editing animation with godot script. You should update points that are set by auto.
Try something like this:
$AnimationPlayer.get_animation("rotate").value_track_set_update_mode(0, Animation.UPDATE_CAPTURE)
Try to uncheck "Reset on Save" option on the AnimationPlayer Node and delete "RESET" animation.
I'm doing an applescript cocoa app and I'd like to run a function as a notification with the name "Finished Downloading" is displayed.
The function changes a value displayed in the main window of the cocoa app and the notification is created with a terminal command line.
I've tried to use observers but couldn't really understand how they work so, even if it's probably the right thing to use, I couldn't get it to work.
property NSNotificationCenter : class "NSNotificationCenter"
script AppDelegate
property parent : class "NSObject"
on myFunction()
log "hey"
end myFunction
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
set ws to workspaceClass's sharedWorkspace()
set nc to ws's notificationCenter()
tell nc to addObserver_selector_name_object_(me, "myFunction()", "Finished Downloading", missing value) --tried this
end applicationWillFinishLaunching_
end script
As the notification named "Finished Downloading" is displayed in the top right corner of the monitor this script should run myFunction
Hope for help, thanks.
Alex
EDIT: thanks to the answer of Willeke I now verified that it's not possible to accomplish what I was trying to do. See Observe for new System Notifications OSX
I use a button on my ruby gtk2 app which starts a longish job processing and I want to disable the button while processing so that the user can't accidentally run it twice. I figured setting button.sensitive = false would do the job and tested it with the following code:
button.signal_connect(:clicked) do
button.sensitive = false
puts "clicked"
sleep 5
button.sensitive = true
end
Clicking on the button after the job has started still seems to put :clicked events on the stack so if I click the button twice more during the sleep, 'clicked' is displayed three times in the console window when I expected it would appear only once.
Do I misunderstand how this is meant to work? If it won't work the way I expect, is there a way to clear the event stack once the job is finished?
Thank you, Torimus - pointed me in the right direction. Apparently it helps if you read the documentation, specifically that of Gtk.events_pending?! Added the following after setting button.sensitive to force the main loop to do its thing:
while Gtk.events_pending? do
Gtk.main_iteration
end
I'm new to ApplescriptObjC as you'll probably see if you keep reading. I was wondering how to get constant feedback from a slider so that as soon as its value is 1 it runs script A and as soon as its value is changed to 0, it runs script B.
I know you can have actions for buttons like:
on buttonClicked_(sender)
do action
end buttonClicked_
But how can I have a one that constantly checks for a change in the slider's value and does the appropriate action? Is it similar to connecting a slider to a text box with the getStringValueFrom() thing?
Any help would be appreciated. Thanks :)
Found out how!
turns out on action_(sender) will work for sliders as well. They send the signal every time the item is clicked on and released whether a change exists or not. Then its a simple matter of an if statement to run two different series of actions depending on the value the slider was set to.
I'm new in Xcode. I want to make a Progress View and below is a label. This label can change value from 1 to 100 just the same when the progress run. For example: when i tap the "Start" button then the progress run from 1 to 100, so does the label run from 1 to 100. Absolutely, i want to see to value change 1,2,3,4... of the label. Can anyone help me?
Code details attached is good. Thanks!
You can use this logic to get your answer.