If I have for example $0.00MXN and I want to extract only the 0.00 I tried this code:
SET !EXTRACT $0.00MXN
SET !VAR1 EVAL("var x=\"{{!EXTRACT}}\"; x=x.replace(/\\D/g,\"\");")
PROMPT {{!VAR1}}
But it prompts me that 000 has been copied, without the decimal points. And then, when it pastes it in the desired field, it pastes the whole $0.00MXN.
Another working solution for you:
SET !EXTRACT $2.3334451MXN
SET !VAR1 EVAL("'{{!EXTRACT}}'.trim().replace(/\\$|MXN/g, '');")
PROMPT {{!VAR1}}
Try the following code:
SET !EXTRACT $0.00MXN
SET !VAR1 EVAL("var x=\"{{!EXTRACT}}\"; x=x.match(/[\\d\\.]+/);")
PROMPT {{!VAR1}}
Related
iMacros v10.1.1 for CR, Free, CR 102.0.5005.115, Win10
I have a few lines of TAGs that I want to work with the same base CONTENT. I want to sum different values for each line, something like:
ATTR=1 CONTENT={{!VAR1}} + 65
ATTR=2 CONTENT={{!VAR1}} + 200
The point is, I need to make those operations with only one variable.
Is there any way to do it?
Every time I try to do a heading with #, it appears a number before the title. How could I still use the #, ##, ### method, but without the appearance of a number? Just with the change of the font size.
For example:
# **Activity 1**
## **1a**
This appears like:
1 Activity 1
1.1. 1a
I only want to get a bigger title for "Activity 1" and a smaller title for "1a". How could I remove the number?
Thank you,
Alicia
To suppress numbering for a specific heading, place {-} after it:
# **Activity 1** {-}
## **1a** {-}
To suppress all heading numbering, try knitr::opts_chunk$set(number_sections = FALSE).
I'm new to Applescript and the world of coding in general. I'm trying small scripts to get my feet wet and have some fun.
I want to make a random prompt generator. I know how to set the variable to a list but what I have in mind is much bigger than a few choices. I was wondering how to get the information from a text file. In said file I have over 200 prompts to choose from. I want to make a script that selects a random one from among these and displays them in a dialog box. I'm having trouble setting the initial variable to the contents of the file as a list. The follow up (random selection) I think I have a pretty good grasp on. I hope this is clear and thank you for looking.
Edit:
Here's my code so far. I keep running into an error: "Can't make "/Users/Home/Desktop/text.rtf" into type file." Not sure what that means.
set draw_promptList to {}
set draw_prompt to read "/Users/Home/Desktop/text.rtf"
repeat with i from 1 to count of paragraphs in draw_prompt
set end of draw_prompt to paragraph i of draw_prompt
end repeat
set the list_count to the count of draw_prompt
set pick to random number from 1 to list_count
display dialog "Try drawing " & some item of draw_prompt & return
Edit 9/28:I fixed it per the revisions and it works. It does exactly what I wanted: selects a random word from among the long list of words in the text file.
set draw_promptList to {}
set draw_prompt to read "/Users/Home/Desktop/test.txt"
set the list_count to the count of paragraphs in draw_prompt
set pick to random number from 1 to list_count
repeat with i from 1 to count of paragraphs in draw_prompt
set end of draw_promptList to paragraph i of draw_prompt
end repeat
display dialog "Try drawing " & some item of draw_promptList
If I understand correctly what you're asking, reading a file and turn each line of that file into an item in a list, then here is one way it can be done.
set theFileOfPromptsList to {}
set theFileOfPrompts to read "/path/to/FileOfPrompts"
repeat with i from 1 to count of paragraphs in theFileOfPrompts
set end of theFileOfPromptsList to paragraph i of theFileOfPrompts
end repeat
If you want to insure you don't add blank lines, if there are any, to the list, then use the following instead:
set theFileOfPromptsList to {}
set theFileOfPrompts to read "/path/to/FileOfPrompts"
repeat with i from 1 to count of paragraph in theFileOfPrompts
if paragraph i of theFileOfPrompts is not "" then
set end of theFileOfPromptsList to paragraph i of theFileOfPrompts
end if
end repeat
For example if I extracted this string 1234hrt-13hfydsfn-12 how could I extract the data so that i could extract the numbers and letters only?
With this code, for example:
SET !EXTRACT EVAL("'{{!EXTRACT}}'.replace(/\W/g, '');")
My libreoffice calc sheet uses the grave accent character ( ` ) as a prefix to numbers. I want to remove all of these characters in the simplest way possible.
Input sheet:
TABLE Year1 Year2 Year3
Price `0.01 `0.02 `0.03
Qty `10 `11 `12
Output sheet:
TABLE Year1 Year2 Year3
Price 0.01 0.02 0.03
Qty 10 11 12
Currently, I have to use search & replace for each cell to achieve this. I search for ( ` ) and replace all individual instances with a blank. This works, but is very tedious. To make matters worse, Search all and Replace all both result in overwriting the complete cell with a blank instead of just matched character.
How can I solve this issue using the options available in Libreoffice calc?
You could go to "Edit", then "Find and Replace" then input your options (a ` and nothing) and "replace all". Make sure that you left the "Entire Cells" box unchecked.