Page 1 of 1
Some really newbie questions
Posted: Tue Jan 29, 2008 6:33 pm
by Sherlab
Well, I'm definately not the most computer saavy guy in the world, so don't be surprised at how stupid these questions might sound.
1) I want my program to load a random image file from a given folder; is this possible?
1.1) If this is possible, would I be able to export the name of teh file opened into a text file?
2) The second part of my program involves bringing in sets of random words to be compared to teh figures; i have a good understanding of how to do this with teh any command, but not a good understanding of how to export the choices of the participant; ie fi I use radio buttons how do I get the chose of the participant to export to an Excel file, and how do I get later stacks in my experiment to export to the same file, but in different rows?
Once again, sorry if this seems incredibly stupid- but like I said, i'm not teh most tech saavy person in the world, and i'm tasked with using runrev to make teh interface for my experiment, so any help would be amazing.
Cheers,
Alan Nielsen
Random
Posted: Tue Jan 29, 2008 7:41 pm
by user#606
1) I want my program .....
Answer Yes, if file names are numbers, use Random to generate the number and call that file. If file names must be text then use a lookup table 1 = pic A etc.
1.1) If this is ....
Answer Yes, now you know the name of the file, add it to an open text file.
2) The second part of my program ....
Answer I am not clear about what you are trying to achieve.
If the words are in a list and the random answer is say 133 then read line 133 in the list. The next bit needs clarification because I cant follow your intent.
Posted: Tue Jan 29, 2008 8:03 pm
by Sherlab
1) So for this use, how would I clarify the order to import teh paint file?
import paint file "Directory/????"
1.1/2) How do I export directly to a cell in an Excel file? Can I get Runrev to create teh excel files, or will I have to make them in advance?
What I really want is to run 150 sets in an experiment
Each set will have:
a) A random picture
b) Two random words with radio buttons to choose
What would need to be exported to an excel file for each set woudl be:
1- the name of the picture, the names of the two generated words, and which was chosen
3) Is it best to pull random words using the any command, or is this "read line" thing you are talking about better?
Posted: Tue Jan 29, 2008 9:28 pm
by Mark
Hi Sherlab,
It seems that you can make your entire programme on one card. This card needs an image object, one or more fields, and a few radio buttons.
To load an image:
Code: Select all
on loadImage
put "Hard Disk/Documents/Folder" into myPath
put the directory into myOldDir
set the directory to myPath
put the files into myFiles
filder myFiles without ".*"
set the filename of img 1 to \
myPath & slash & any line of myFiles
set the directory to myOldDir
end loadImage
To fill the field:
Code: Select all
on fillField
put empty into fld 1
put the cWordList of this stack into myWordList
repeat 4
put random(number of words of myWordList) into myWordNr
put (word myWordNr of myWordList) & cr after fld 1
delete line myWordNr of myWordList
end repeat
delete last char of fld 1
end fillField
Make as many radio buttons as necessary and group them. Don't change the names of the buttons when a new picture us shown but set the labels of the buttons. To remember the answers the user gives by clicking on a radio button, keep the answers in a global variable. Put the following code into the group script:
Code: Select all
on mouseUp
global gAnswerList
put the label of the target & cr after gAnswerList
end mouseUp
Of course, this code assumes that the user clicks once and doesn't want to change his/her choice. If you want the user to be able to change, you might need to add a button, e.g. with the name "Next Picture" or "Choose". This button would have the following code:
Code: Select all
on mouseUp
global gAnswerList
put the label of btn (the hilitedButton of grp "Your Group") \
of grp "Your Group" & cr after gAnswerList
end mouseUp
and the group would have no script.
I didn't test these scripts, but I hope they give you some idea of what is required.
Best,
Mark
Posted: Tue Jan 29, 2008 9:34 pm
by Sherlab
Mark wrote:Hi Sherlab,
It seems that you can make your entire programme on one card. This card needs an image object, one or more fields, and a few radio buttons.
To load an image:
Code: Select all
on loadImage
put "Hard Disk/Documents/Folder" into myPath
put the directory into myOldDir
set the directory to myPath
put the files into myFiles
filder myFiles without ".*"
set the filename of img 1 to \
myPath & slash & any line of myFiles
set the directory to myOldDir
end loadImage
So I'd put this part of the code in the image field?
Mark wrote:
To fill the field:
Code: Select all
on fillField
put empty into fld 1
put the cWordList of this stack into myWordList
repeat 4
put random(number of words of myWordList) into myWordNr
put (word myWordNr of myWordList) & cr after fld 1
delete line myWordNr of myWordList
end repeat
delete last char of fld 1
end fillField
I'm not quite sure which field you mean here; sorry that i'm not up on teh technical lingo for this program as of yet; where woudl this script go?
Mark wrote:
Make as many radio buttons as necessary and group them. Don't change the names of the buttons when a new picture us shown but set the labels of the buttons. To remember the answers the user gives by clicking on a radio button, keep the answers in a global variable. Put the following code into the group script:
Code: Select all
on mouseUp
global gAnswerList
put the label of the target & cr after gAnswerList
end mouseUp
Of course, this code assumes that the user clicks once and doesn't want to change his/her choice. If you want the user to be able to change, you might need to add a button, e.g. with the name "Next Picture" or "Choose". This button would have the following code:
Code: Select all
on mouseUp
global gAnswerList
put the label of btn (the hilitedButton of grp "Your Group") \
of grp "Your Group" & cr after gAnswerList
end mouseUp
and the group would have no script.
I didn't test these scripts, but I hope they give you some idea of what is required.
Best,
Mark
And how would I get all of this to export to excel? O ranythign for that matter?
Sorry; this is all way over my head, and being a student I don't have nearly enough time to learn programming.
Posted: Tue Jan 29, 2008 9:48 pm
by Mark
Sherlab,
You can put the loadImage and fillField handlers at card level. First try to understand how Rev works. Then take a few days (rather than a few minutes) to figure out how to use the scripts I posted. When you got that, search the built-in docs for the write command.
Best,
Mark
Posted: Tue Jan 29, 2008 11:02 pm
by Sherlab
For the record, i have spent more than a couple of days attempting to understand how revolution works; but frankly for someone who isn't a programmer already the tutorials are worthless
That being said; the first approach suggested seems much more simple; and I'd like to avoid getting into code which goes too far over my head (which may regrettably be all of it)
I pasted in your code to try and take a look at how it works, but it wouldn't even compile when I changed teh directory to teh appropriate one, so I'm not exactly sure what is going on.
Is there somewhere on this forum that work can be contracted out? Because of this is as difficult as you make it sound I have no interest in learning.
Edited for Frustration- Sorry, just having a lot of troubel with this as a non-programmer adn am finding that blindling sifting through the dictionary which comes with the product isn't really helping a whole lot
I realize that the script for the image loading wasn't working because filter had been mispelled, so I changed that, but I still can't get anything to load from teh script.
Currently I have the stack set up with 2 unscripted radio buttons, an unscripted next button, and an empty image field, but the script doesn't appear to be doign anythign
Am I doing something wrong? Or am I doing anythign right?
Posted: Tue Jan 29, 2008 11:14 pm
by Mark
Hi Sherlab,
There are a few people around, who do consulting work. I'm one of those and there are a few more on the RunRev website. Feel free to send me a private message or an e-mail, we might work something out.
It is possible that the scripts I posted don't compile, since I didn't test them, and removing any errors takes at least some basic knowledge of Revolution.
The suggestion made by user#606 (an interesting nickname btw) sounds simple, but will eventually be more complicated than the scripts I posted, even though the two approaches are similar. You probably don't want put more effort into managing lists of words and files than necessary.
Best,
Mark