Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'd like to be able to divide the value of a variable in Automator by 2, before being passed to the next step. I imagine it can be done with 'run applescript' but can't figure out how.
Sure. If you have a variable with a number in it, you can:
Get Value of Variable
Run AppleScript
with the AppleScript something like:
on run {input, parameters}
set halfInput to input / 2
return halfInput
end run
I’ve attached a screenshot of this, so you can see how it works.
Note that depending on where the variable is set, it might be a list, in which case you’ll need to get the appropriate item from the list. For example, passing the result of a shell script to a variable will mean that the value is in a list, and the AppleScript will need to get the “first item of input” in order to treat that value as a number. Here’s an example:
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Is there a way to make it so that there isn't a list of constants at the top of every bash script i have? I have a lot of readonly constants for formatting and such but having them at the top of every single one of my scripts takes up space. Is there a way to make a separate script containing all of them and access it or something? or some way to clean it up?
Use a common script that you source in your other scripts.
E.g. source common.sh will execute that file and you may export variables there.
This is also how files like .bashrc and .bash_profile work, it is sourced when you execute bash (the latter when it is a login shell). When you change .bashrc, you can source it again in the running shell for the changes to take effect.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a oracle form that has two blocks . I would like to have the cell change color base on it's value null or not . How can this be done?
There are two built-ins you can use: SET_ITEM_PROPERTY and SET_ITEM_INSTANCE_PROPERTY (have a look at Forms Online Help System for more info).
if you use the first one, it'll change all items in a tabular block (i.e. the whole column)
it means that - if it really is a tabular form ("two blocks" sound like "master-detail" where detail usually has tabular layout - you should use the second one, SET_ITEM_INSTANCE_PROPERTY which will change only one instance of that item
For example, you'd do this:
if :system.cursor_item is null then
set_item_instance_property(:system.cursor_item, current_record, visual_attribute, 'RED');
end if;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to run a batch file with the following code:
set dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In
set dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut
set dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed
The batch file does not run and shuts down immediately and I cannot figure out what is wrong.
Couple of things you need to understand. When we set variables, we typically enclose them in double quotes in case there are whitespace, which after the whitespace, the next field is seen by cmd as a new command and you will get some errors you would not want, such as the infamous "Is not recognised as an internal command on batch file` error, so we would therefore rather do this:
set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"
The code then does exactly what you told it to do and that is to simply set variables %dirA% %dirE% and %dirC% with the respected values.
Now to see a result, you need to do something with those variables, perhaps we echo them?
#echo off
set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"
echo %dirA%
echo %dirE%
echo %dirC%
pause
Your script runs, but it finishes almost immediately.
If you add a pause command at the end, the window will stay open until you press a key.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to be able to input a number and choose a variable then what the variable is set to then its subtracted by the number inputed and displayed in a TextBox when i click the calculate button (I'm trying to create a rank calculator for a game).
[Current cR is TextBox1, Choosen Rank is ComboBox1 and Calculate is Button1]
The Template
http://imgur.com/ofre43a
It will look something like this if I understand your equation correctly.
private1-textbox1.value/agxp = rgr
I think that is essentially what you are asking. I am assuming you will have assigned a value to private1 previously and that the ccr is inputed by the user. I also am assuming that your agxp is also previously assigned. There is the possibility that the value in textbox1 will be read as a string not as an integer. If that is the case, you will have to convert it to an integer.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
So I have this line:
if self.company_changed?
And it works fine but this detects if the company has changed on the object. I need to know if the database value has changed and not if the value in memory has changed. So I tried this:
if :company_changed?
This seems to work in debug mode when I only execute the one line. If I let it run, it fails in testing on an infinite loop.
My question is what can be used in ruby to check to see if the column value has actually changed.
I'm pretty sure you're actually talking about ActiveRecord. In which case, you'd need to re-fetch the record to see if the value has changed in the database.
self.class.find(self.id).company != self.company
A general purpose method for this might be something like:
def attr_changed_in_db?(attr)
self.class.find(self.id).attributes[attr] != self.attributes[attr]
end
There is an excellent screencast on this by the great Ryan Bates.