Got error: Bad arguments of Enable

Bad arguments of Enable/ the operation Enable cannot accept the argments

Hi all.
the example of KIO4-Base64's: Base64_Simple.aia tested works well.
I modofied it try to screenshot the screen and then Base64 it as attached got this error.


Base64_Simple_1 (1).aia (547.0 KB)

Your issue is in this event:

image

Any Enabled block is boolean, so you can only set to true or false

Also, why are you naming the screenshot twice, and after the screenshot has been taken ? IIRC, you need to set the filename BEFORE you take the screenshot.

And you already have the image (in the ASD), saved by the screenshot, why are you creating it again in the ASD, or is this aia simply for testing ?

1 Like

Good!
modified the blocks the screenshot works.

the " Image in assets to Base 64 " button pressed nothing happened now?

new blocks: what the File not find mean?

Try this, made a few changes, so that you can work with the file (screenshot) in the ASD.

Loading the entire base64 string to a label can often causes the app to freeze, so I just captured the first 20 characters, so that I could see I was getting base64 back.

Base64_Simple_Revised.aia (547.0 KB)

1 Like

Thanks.

still the screenshot works, and the Image to Base64 button not work.
it had show a error too fast to be catched, seem text exceed kind of, so I made the Length = 10; got here.

Yes, sorry, I took out the filenaming for the screenshot, by accident. Put it back.

image

1 Like

Great!
it works.
how to show the all strings data (here I put length=100)? if it is too long, is it possible to reduce the image of the screen shoted ?
Capture33

See my comment above about app freezing.

resize the image components

1 Like

Sure.
Thank you and have good night.

Sorry bringing up this topic again, this blocks to do: 1) screenshot and put it into image1, 2) to convert the image in image1 into Base64;

I just can't get there, because the image1 was signed a picture at the APP, the image put into it can't be pick to do the convert? how to it please?

Thanks.

Tested and working, companion and compiled on Android 6.01 (the oldest working device I have)

moveScreenshot.aia (16.6 KB)

1 Like

You're wonderful!
it works perfect on my phone.
thanks

BTW: because of the image size too large:

  1. can the TaifunScreenshot save as jpeg? or can it set image size;
  2. can Base64Convertor do the above function to reduce?
    Thanks.

No to both 1 & 2. (jpeg is the same as jpg)

You can use an Image extension such as ImageConvertor to resize the image.

1 Like

good thanks.

Before you ask, blocks should look like this:

1 Like

lot of thanks to you TIMAI2Power User

The blocks work well even with 400 size and 1-400 length.
one thing I'd like to make clear, is the image size reduce really reduced the encoded data length? because the TaifauScreenshot made image size reduced half with each next click ?

I added the resize blocks into this topic block, and put the screenshot in the same lblFileName, test result ask : first need to take picture, whats wrong?

Base64_Simple7 (1).aia (1.0 MB)

You can test your hypothesis by comparing the length of the base64 string before and after resizing.

You appear to be following a different approach and using different extensions to the ones I proposed, making it more difficult for me to advise.

I suggest you simplify, run each part of your blocks code step by step, using Do It with companion to see the various outputs in each step, to find your issue.

1 Like

Thanks.

I've tested to combine the two blocks above: #4 and #10, seems there is no reduce? the purpose is to take screenshot and reduce its size and encode it as strings.

I pressed two times of the ss button to take screenshots and to encode, both got about 8 pages of my screen, same length?

Base64_Simple5O_MIT.aia (519.3 KB)

My previous example, 4 posts up, does this...

1 Like

Thanks.

I told you the app might freeze up if you tried to show the base64 string in a label.

1 Like