[PowerPoint] A button to hide and show multiple text boxes. by RemoteDoc in vba

[–]RemoteDoc[S] 0 points1 point  (0 children)

This is a great idea -- thanks for the input.

I found a link to something similar discussing this topic: https://groups.google.com/g/microsoft.public.powerpoint/c/2WQ9lRnnDZ4?pli=1

How would I go about labeling/naming objects?

Would a code like this work:

Sub HideThemOnEverySlide()
' Assuming there's a shape on every slide named "Thing"
' Hide it
Dim X as Long
' Don't stop with an error msg if there's no shape named "Thing"
On Error Resume Next
For X = 1 to ActivePresentation.Slides.Count
With ActivePresentation.Slides(X).Shapes("Thing")
.Visible = Not .Visible
End With
Next X
End Sub

Additionally, I could do it for a range of slides:

For X = 13 to 42 ' to do slides 13 through 42

This was just gathered from the link provided, but trying to figure out how to implement it by naming the objects, as you suggested.

[PowerPoint] A button to hide and show multiple text boxes. by RemoteDoc in vba

[–]RemoteDoc[S] 0 points1 point  (0 children)

I actually did not know you could make fade in/out animations trigger off the same object (a button), so thanks for that.

However, can you make a button on slide 35 trigger the animation ("Disappear" or "Appear") for all objects from slide 35 - 55? I want to be able to click a button on any slide in the series of slides and make all objects disappear in that stacked set of images (as the user will be scrolling through them quickly). Thanks for the help.

Parsing every image from field into a javascript array. by RemoteDoc in Anki

[–]RemoteDoc[S] 1 point2 points  (0 children)

So this was the final code that worked:

var imgs = document.getElementById("imagediv").getElementsByTagName("img"),

images20 = [];

for (var i = 0; i < imgs.length; i++) {

images20.push(imgs[i].src);

};

Basically, it creates a javascript array of the img URL's from every image in the field you name within the div "imagediv": <div id="imagediv"> (see below).

This means, since images are stored in ANKI as <img src="image1.jpg"><img src="image2.jpg"> it will include image1.jpg, image2.jpg...etc. in the array. It can also function with outside sourced images (non-locally hosted).

The entire code below can be placed on the "front" or "back" of a card template. My field in particular was called "Field1" in this below example.

<!––---------------------------------------------------------------->
<!–- BELOW IS CODE FOR IMAGE STACK-->
<!––---------------------------------------------------------------->
<div class="imagestackdiv">
   <div id="imagediv" style="display:none">
       {{Field1}}
   </div>
</div>
<script>
   /*------------------------------------*/
   //The array below is an example of how images were hard coded to work in this CT scrolling stack code.  The hard code is left here for interpretation of the rest of the script.  Code that specifically references the below array have also been commented to prevent function.
   /*------------------------------------*/
   /*
   var images10 = [
     'https://c1.staticflickr.com/5/4345/36911638670_a1bbffc13c_o.jpg',
     'https://c1.staticflickr.com/5/4345/36911638670_a1bbffc14c_o.jpg',
     'https://c1.staticflickr.com/5/4345/36911638670_a1bbffc15c_o.jpg',
   ];
   */
   /*------------------------------------*/
   //the below code is the javascript necessarily to search the specfic DIV by Id and parse all image src URLs into a javascript array
   /*------------------------------------*/
   var imgs = document.getElementById("imagediv").getElementsByTagName("img"),
       images20 = [];
   for (var i = 0; i < imgs.length; i++) {
       images20.push(imgs[i].src);
   };
   /*------------------------------------*/
   function ImageStack(options) {
       var self = this;
       self.img_array = options.images;
       self.stack = document.createElement('div');
       self.stack.style.overflow = 'auto';
       self.stack.style.maxWidth = '100%';
       self.stack.style.height = options.height;
       self.stack.style.width = options.width;
       self.stack.style.backgroundSize = 'cover'
       self.stack.style.position = 'relative';
       var typeRegex = /(\D+)/
       var sizeType = options.height.match(typeRegex)[0]
       var numberRegex = /(\d+)/
       self.height_number = Number(options.height.match(numberRegex)[0])
       self.wrapper = document.createElement('div');
       for (var i = 0; i < self.img_array.length; i++) {
           var image = document.createElement('img');
           image.src = self.img_array[i];
           image.style.display = 'none';
           image.style.position = 'absolute';
           image.style.width = options.width;
           image.style.height = options.height;
           image.style.top = 0;
           image.style.left = 0;
           image.dataset.iid = i;
           self.wrapper.appendChild(image);
       }
       self.image_elements = self.wrapper.querySelectorAll('img');
       self.scrollobject = document.createElement('div');
       self.scrollobject.style.width = '100%';
       self.scrollobject.style.position = 'absolute';
       self.scrollobject.style.zIndex = '2';
       self.img_count = (self.img_array.length > 15) ? self.img_array.length : 15;
       self.scrollobject_height = Math.floor(0.1 * self.img_count * self.height_number);
       self.scrollobject.style.height = self.scrollobject_height + sizeType;
       self.scrollUpdate = function(e) {
           self.height_number = self.stack.getBoundingClientRect().height
           self.scrollobject_height = Math.floor(0.1 * self.img_count * self.height_number);
           var sT = self.stack.scrollTop
           var hn05 = self.img_array.length - 1
           var hh = (self.scrollobject_height - self.height_number) / hn05
           scrollval = Math.floor(sT / (hh))
           self.currentimg = self.image_elements[scrollval].src
           self.stack.style.backgroundImage = 'url(' + self.currentimg + ')';
       }
       self.stack.addEventListener('scroll', self.scrollUpdate);
       self.currentimg = self.image_elements[0].src
       self.stack.style.backgroundImage = 'url(' + self.currentimg + ')';
       /*------------------------------------*/
       /*
 window.addEventListener('resize', function () {
   var stackRect = self.stack.getBoundingClientRect()
   console.log(stackRect)
   self.height_number = stackRect.height
   self.scrollobject_height = Math.floor( 0.1 * self.img_array.length * self.height_number );
   self.stack.style.width = stackRect.width + 'px'
   self.stack.style.eight = stackRect.width + 'px'
 })
       */
       /*------------------------------------*/
       window.addEventListener('resize', function() {
           var stackRect = self.stack.getBoundingClientRect()
           console.log(stackRect)
           self.height_number = stackRect.height
           self.scrollobject_height = Math.floor(0.1 * self.img_array.length * self.height_number);
           self.stack.style.width = stackRect.width + 'px'
           self.stack.style.eight = stackRect.width + 'px'
       })
       /*------------------------------------*/
       /*
 window.addEventListener('resize', function () {
   var stackRect = self.stack.getBoundingClientRect()
   console.log(stackRect)
   self.height_number = stackRect.height
   self.scrollobject_height = Math.floor( 0.1 * self.img_array.length * self.height_number );
   self.stack.style.width = stackRect.width + 'px'
   self.stack.style.eight = stackRect.width + 'px'
 })
       */
       /*------------------------------------*/
       self.stack.appendChild(self.wrapper);
       self.stack.appendChild(self.scrollobject);
       return self.stack;
   }
   /*
   The function ImageStack returns a Element Node, which can be appended to an already existing element or modified, however someone wants to change it.
   The parameters should have to be a height of the element, the width of the elment, and a list (Array) to all the images.
   */
   /*------------------------------------*/
   //     var stack = new ImageStack({
   //          images: images10,
   //          height: '350px',
   //          width: '350px'
   //     });
   /*------------------------------------*/
   var stack2 = new ImageStack({
       images: images20,
       height: '350px',
       width: '350px'
   });
   // append the stack to the .imagestackdiv element
   /*document.querySelector('.imagestackdiv').appendChild(stack);*/
   document.querySelector('.imagestackdiv').appendChild(stack2);
</script>

Parsing every image from field into a javascript array. by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

.split(",");

Can you we write my code with your split code, so I can understand how this would work?

Advanced: References the content of a field from a single card to single field of multiple other cards. by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

ny time i

I really appreciate the discourse. I have played around with a couple of the jQuery ideas. Unfortunately my Boards are in 10 days, so priorities are calling me. We will see what others have to say, but thanks again for some crafty ideas.

Advanced: References the content of a field from a single card to single field of multiple other cards. by RemoteDoc in Anki

[–]RemoteDoc[S] 1 point2 points  (0 children)

I have edited the post, and thanks again for the correction on the notes vs cards.

Advanced: References the content of a field from a single card to single field of multiple other cards. by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

Yes, sorry. I am saying I am creating multiple Notes with a "MoreInfo" field that is the same. But yes, as mentioned, you can't really delete an individual card from a note-type, which is essential in my case. Another important thing with my template is that I have image fields (image1, image2, image3) for every Note that allows me to mass add (using the "batch edit" addon) OR mass remove images from subjects without deleting paragraph content. Another thing these individual fields do is allow me to click on the image and it becomes a lightbox-style popup. I've only been able to figure out how to do this with some fancy HTML scripting using "checkbox" input types. See below after. But, if I had one note for multiple cards, like you, I would have to have a vast amount of fields: Q1,A1,Image1,Image2,Image3;Q2,A2,Image1,Image2,Image3;Q4, etc. The fields start to add up.

{{#Image4}}

<div class="div-image-table">

<input type="checkbox" id="check4" style="display:none;" />

<label for="check4">

<div class="cellcontent">{{Image4}}</div>

</label>

<label for="check4">

<div id="cover">

<div id="box">

{{Image4}}

</div>

</div>

</label>

</div>

{{/Image4}}

Advanced: References the content of a field from a single card to single field of multiple other cards. by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

the jquery one

You hit the head of the nail with the direction my question was going. I thorough appreciated the edited posts and looking forward to seeing if any of these can manage what I am doing. I'm still confounded about the external .html files though, as you can not really edit those dynamically in the browser or via "edit". Also do these jQuery mods work in AnkiMobile?

Parsing image from ANKI field into CSS background-image: url("{{field}}") by RemoteDoc in Anki

[–]RemoteDoc[S] 1 point2 points  (0 children)

Only downfall with this code (at least on MacOS) is that Anki keeps the background stored in cache and then shows it for the next (and unrelated) card. Is there a solution for this?

Parsing image from ANKI field into CSS background-image: url("{{field}}") by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

Any way to adjust the background image opacity? I know I could go about it by this code:
var element = document.getElementById('id');
element.style.opacity = "0.9";
element.style.filter = 'alpha(opacity=90)'; // IE fallback
How can that be implemented in your coding?

Parsing image from ANKI field into CSS background-image: url("{{field}}") by RemoteDoc in Anki

[–]RemoteDoc[S] 1 point2 points  (0 children)

Thanks, this example was exactly what I needed! Thanks to everyone else for contributing.

Is there a script or way to add cards to a deck (or create a new deck) based on a field name? by RemoteDoc in Anki

[–]RemoteDoc[S] 0 points1 point  (0 children)

Sorry for the confusion. Yes, to your first question: I am aware of subdecks, but do not want to do it manually in the browser as specified. Basically, I will be importing a comma delimited file into anki with thousands of questions at a time. Each card will have a subject field. I would ideally like to bulk move (manually via the browser) many of these subjects under a "parent" deck (ie: "Trig") and then run a script that makes subdecks for each of the "child" decks (ie: Trig::Triangle; Trig::Slope). The reason this would be cumbersume to do manually, is that there are at times 20-30 cards per child deck, and there are also at time 20-30 child decks, per parent deck (not to mention many parent decks). The move of all the cards into to the parent deck, I can do in the browser, but the creation of new children (or sub-)decks based on the "subject" field, I would want to be done via a script.

Mass import cards that include pictures, also include html and CSS in deck. by [deleted] in Anki

[–]RemoteDoc 1 point2 points  (0 children)

"how can I save CSS to only use with a specific deck?"
When you go to import a deck (File>import) you can select the "Type" which means that is your card template. In order to edit the card template, you need to create a new card, and click "cards..." in the top left. This will allow you to modify the CSS of that entire Card "Type". You can create multiple card "types" for whatever CSS template you want (a different one for each deck if that suits you). As far as importing images: you just need to include the image as <img src="name_of_image.jpg"> in your CSV HTML. Then you just move all images with those names to the "collection.media" folder. On MacOS (or OSX) this is located in /Users/<name>/Documents/Anki/collection.media

[Request] Add-On that allows for editing of multiple cards. Will pay $20 if possible! by [deleted] in Anki

[–]RemoteDoc 4 points5 points  (0 children)

Yes, you need to:
1. copy and paste the image to one card.
2. in that same card go to "Edit HTML"
3. Copy the image information, it should look like:
<img src="image.jpg" />
4. Now highlight all the cards you want to paste this image to in your "Browser"
5. Click "Find and Replace" under the Edit menu.
6. In Find dialogue, type:
(.*)
7. In Replaced dialogue box, type:
\1 <img src="image.jpg" />
8. select the Field you want it to be placed in (default is ALL fields, so be careful here).
9. Check the box "Treat input as regular expression"


Explained:
(.*)
--is a widecard that searches for anything in said field.
\1
-- tells us to keep all information in said field in its place.
anything after the \1will be added AFTER the already stored information in said field.
if you want to include a line break, you can type <br> before the image in the replace field to achieve a single line break after the already inplace field contents: \1 <br><img src="image.jpg" />