Jump to content

Recommended Posts

Posted

Well i have now been seaching the internet for some hours and i cant figure out how to script what i need :/

so i came to the idea that maybe you guys could figure it out for me :)

i will go though it step by step

1 i need to go to my image folder

2 in that folder i want to select/highlight 50 random files

job done ;)

i need to select 50 random images in this folder 3 times everyday so it would be pretty helpful if anyone knows how to do that ;)

Posted

Would it be acceptable to copy/move the 50 files to another folder instead? That'd be easier and more reliable. You can then select all files in that folder.

Posted

great, but i still dont know how :)

i cant script at all and im not going to learn since im already studying drawing, 3d and 2d graphis and going to school in 3 weeks so sorry no time to learn anymore :/

Posted (edited)

Edit: yeah I just read that last post. never mind then. Study the helpfile for a day and you will be well on your way to writing basic scripts.

I can assure you you're going to find it a lot more educational than the first month of school.

Edited by Tvern
Posted

How much is it worth to you?

not so much that i will pay for it ;)

JohnOne

well i read another post where someone asked for help to some code and someone just wrote the code he needed in a reply so i figured it was worth a try :)

Posted

Fair enough.

But if you look at and run the examples of the functions mentioned you will have a script in no time at all.

$array = _Filelisttoarray("path") will give you an array as mentioned.

Ramdom(1,$array[0],1) will give you a random number withing the bounds of your array.

A little if else logic will see you from there.

Write that, and you will get all the help you need here.

Good luck.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

thx alot i will give it a shot :)

edit : ok i been reading the help file a little and messing around with lines of code you suggested and well im getting nowhere :s i understand nothing of what im doing actully in this program :/

Edited by spitzer89
Posted

so this is kinda getting on my nerves so i will pay the person who can make me a script that fixs my problem 5 dollars the money will be sent to you with paypal

Posted (edited)

You can send the five snots to the forum as a donation.

http://www.autoitscript.com/site/donate/

#include <File.au3>

Local $i_NumPics = 50
Local $a_RandomNumber[$i_NumPics]

$s_ImageArray = _FileListToArray("C:\my\folder\path", "*", 1) ; array of all files in your image folder
$b_Unique = True
For $i = 0 To UBound($a_RandomNumber) - 1
    Do
        $b_Unique = True ; presume number is unique 
        $irnd = Random(1, Int($s_ImageArray[0]), 1) ; select a random number withing imagearray bounds
        For $j = 0 To UBound($a_RandomNumber) - 1 ;loop throug
            If $irnd = $a_RandomNumber[$j] Then ; you already have that number
                $b_Unique = False ; booooooooooooooo
                ExitLoop
            EndIf
        Next
        If $b_Unique Then ; we dont have that number
            $a_RandomNumber[$i] = $irnd ; yaaaaaaaaaay
        EndIf
    Until $b_Unique ; keep going until random number is unique
Next

For $i = 0 To UBound($a_RandomNumber) -1
    ConsoleWrite($s_ImageArray[$a_RandomNumber[$i]] & @CRLF) ; list your image files
Next
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

so atm it looks like this

#include <File.au3>

Local $i_NumPics = 50

Local $a_RandomNumber[$i_NumPics]

$s_ImageArray = _FileListToArray("C:\Users\Steffen\Desktop\imagestest", "*", 1) ; array of all files in your image folder

$b_Unique = True

For $i = 0 To UBound($a_RandomNumber) - 1

Do

$b_Unique = True ; presume number is unique

$irnd = Random(1, Int($s_ImageArray[0]), 1) ; select a random number withing imagearray bounds

For $j = 0 To UBound($a_RandomNumber) - 1 ;loop throug

If $irnd = $a_RandomNumber[$j] Then ; you already have that number

$b_Unique = False ; booooooooooooooo

ExitLoop

EndIf

Next

If $b_Unique Then ; we dont have that number

$a_RandomNumber[$i] = $irnd ; yaaaaaaaaaay

EndIf

Until $b_Unique ; keep going until random number is unique

Next

For $i = 0 To UBound($a_RandomNumber) -1

ConsoleWrite($s_ImageArray[$a_RandomNumber[$i]] & @CRLF) ; list your image files

Next

but nothing happens when i run it :s ?

Posted

well cant figur it out :s anyways i have fixed the problem myself i found a program called mix2stick that kinda does what i need but thx for trying

Posted

Yeah, there are a couple of members who have fully coded, debugged, feature filled custom solutions ready for newbs who ask for help in like five minutes flat. I can't explain it how they do it.

Posted (edited)

well cant figur it out :s anyways i have fixed the problem myself i found a program called mix2stick that kinda does what i need but thx for trying

So don't give up so eazily!

You only missed one slash:

#include <File.au3>
Local $i_NumPics = 50
Local $a_RandomNumber[$i_NumPics]
$s_ImageArray = _FileListToArray("C:\Gifs\Users\Steffen\Desktop\imagestest\", "*", 1) ;<<<<  === study this line carefully
$b_Unique = True
For $i = 0 To UBound($a_RandomNumber) - 1
    Do
        $b_Unique = True ; presume number is unique
        $irnd = Random(1, Int($s_ImageArray[0]), 1) ; select a random number withing imagearray bounds
        For $j = 0 To UBound($a_RandomNumber) - 1 ;loop throug
            If $irnd = $a_RandomNumber[$j] Then ; you already have that number
                $b_Unique = False ; booooooooooooooo
                ExitLoop
            EndIf
        Next
        If $b_Unique Then ; we dont have that number
            $a_RandomNumber[$i] = $irnd ; yaaaaaaaaaay
        EndIf
    Until $b_Unique ; keep going until random number is unique
Next

For $i = 0 To UBound($a_RandomNumber) - 1
    ConsoleWrite($s_ImageArray[$a_RandomNumber[$i]] & @CRLF) ; list your image files
Next

Adding note == >

Edited by JoHanatCent
Posted

So don't give up so eazily!

You only missed one slash:

#include <File.au3>
Local $i_NumPics = 50
Local $a_RandomNumber[$i_NumPics]
$s_ImageArray = _FileListToArray("e:\Gifs\Users\Steffen\Desktop\imagestest\", "*", 1) ;<<<<  === study this line carefully
$b_Unique = True
For $i = 0 To UBound($a_RandomNumber) - 1
    Do
        $b_Unique = True ; presume number is unique
        $irnd = Random(1, Int($s_ImageArray[0]), 1) ; select a random number withing imagearray bounds
        For $j = 0 To UBound($a_RandomNumber) - 1 ;loop throug
            If $irnd = $a_RandomNumber[$j] Then ; you already have that number
                $b_Unique = False ; booooooooooooooo
                ExitLoop
            EndIf
        Next
        If $b_Unique Then ; we dont have that number
            $a_RandomNumber[$i] = $irnd ; yaaaaaaaaaay
        EndIf
    Until $b_Unique ; keep going until random number is unique
Next

For $i = 0 To UBound($a_RandomNumber) - 1
    ConsoleWrite($s_ImageArray[$a_RandomNumber[$i]] & @CRLF) ; list your image files
Next

Adding note == >

thx i will look into this later, but for now i have a drawing class to attend to :) but i kinda like this forum people are pretty helpful ;)

hehe i know i give up pretty easy but code really isnt my strong side im more a well visual kinda guy ;)

Posted

Well you should bear in mind that a programing language will most likely come into play at some point during your Drawing education, and it wont harm you to get a head start.

You could think of Autoit as a hobby if you want, but I guarantee it will help you in the future.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...