Jump to content

Two questions


Recommended Posts

I'm making a script for teachers and i have 2 problems with the GUI:

1. How can I make the gui have Vertical scrol working, because with koda (Vscroll) it doesn't work.

2. and how can I make that the teacher can save the marks, like another programe (word, etc.)

thanks,

olivarra1

Link to comment
Share on other sites

I'm making a script for teachers and i have 2 problems with the GUI:

1. How can I make the gui have Vertical scrol working, because with koda (Vscroll) it doesn't work.

2. and how can I make that the teacher can save the marks, like another programe (word, etc.)

thanks,

olivarra1

Without code the best I can suggest at the moment is.....

For question #1 see this thread by Gary Frost.

Scrolling GUI's

For #2 see the word.au3, excel.au3 and sqlite.au3 files in the AutoIt\includes folder.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I'm making a script for teachers and i have 2 problems with the GUI:

1. How can I make the gui have Vertical scrol working, because with koda (Vscroll) it doesn't work.

2. and how can I make that the teacher can save the marks, like another programe (word, etc.)

thanks,

olivarra1

First, posting in the AutoIt v3 -> GUI Help and Support forum might have resulted in more help for you in the long run regarding your scrolling GUI. Just think about that for next time. Also, posting some kind of informative title or subtitle would help your chances, too. (more than just "Two Questions"...people are less inclined to click on something just to see the subject of what you're asking).

That being said, welcome to AutoIt! :D Sounds like you've got an ambitious project ahead of you.

1) Check out the thread at http://www.autoitscript.com/forum/index.ph...=scrollable+gui for how to get GUI's scrollbars to work.

2) You're going to have to do that manually. Assuming you've got the marks already accessible to the program (variables or input controls' contents), look into the INI functions (notably INIRead and INIWrite). That allows you to store and retrieve data in a file by section and key (in your case, that could translate student and assignment). Note carefully the technical limitations of these functions however: 32kb is the magic amount of data that you shouldn't go over, otherwise you'll start getting inexplicable results. If you needs are more complex than that, you could use the _SQLite_ functions to actually read and write your own database.

Otherwise, just use FileWrite and FileRead and come up with your own system for being able to store and retrieve data. For instance, maybe each line of data represents a single student's single assignment, but in that case, how will you know which assignment and which student each line represents? You could separate each of these bits of information with a comma, so a typical line might look like:

Pop Quiz 1,Martin,94

Then when you want to retrieve your data, you'd read the line (FileReadLine), StringSplit() it at the commas, and assume that the assignment name will be split [1], the student's name split [2] and their score in split number [3]. This is just one possibility - since every file is just a string of characters, your save file could be absolutely any format you want...you just have to have a system and adhere to it.

Long story short, there's no magic "save or restore the current state of my autoit window" function. But since you can write anything you want into whatever filename you specify, you can do it on your own any way you want.

Try posting things you've tried, and we can help you work through the stuff that isn't working!

Edit: sorry, GEOsoft posted while I was typing :P

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

still having problems for my first question:

Dim $etapa[6][2];[1r,2n,3r,4t,1rb,2nb][XY,XX]
For $i = 0 to 5;nois
    $etapa[$i][0] = FileReadLine(@ScriptDir & "nois.txt", $i + 1)
Next
For $i = 0 to 5;noies
    $etapa[$i][0] = FileReadLine(@ScriptDir & "noies.txt", $i + 1)
Next

Do
    $num_alumnes = InputBox("EF", "abans de obrir el programa, cal que diguis quants alumnes tens")
Until @error = 0 and $num_alumnes > 0

dim $qt_nom[$num_alumnes], $cb_noinoia[$num_alumnes], $qt_velocitat[$num_alumnes], $qt_nvelocitat[$num_alumnes], $qt_cames[$num_alumnes], $qt_ncames[$num_alumnes]; gui
dim $qt_flexibilitat[$num_alumnes], $qt_nflexibilitat[$num_alumnes], $qt_navette[$num_alumnes], $qt_nnavette[$num_alumnes], $qt_agilitat[$num_alumnes], $qt_nagilitat[$num_alumnes]
dim $qt_agilitat[$num_alumnes], $qt_nagilitat[$num_alumnes], $qt_copper[$num_alumnes], $qt_ncopper[$num_alumnes], $qt_abdominals[$num_alumnes], $qt_nabdominals[$num_alumnes]
dim $qt_bracos[$num_alumnes], $qt_nbracos[$num_alumnes], $qt_forca[$num_alumnes], $qt_nforca[$num_alumnes], $qt_mitjana[$num_alumnes], $qt_quali[$num_alumnes]

#include <GUIConstants.au3>
#include <GUIScrollBars.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Victor\Mis documentos\Informatica\Creacions\Autoit\EF\EF.kxf
$EF = GUICreate("EF", 1111, 90 + 32 * $num_alumnes, 76, 241, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
_GUIScrollBars_Init($EF)
$Label1 = GUICtrlCreateLabel("Nom de l'alumne", 8, 8, 82, 17)
$Label2 = GUICtrlCreateLabel("Noi o noia?", 104, 8, 58, 17)
$Label4 = GUICtrlCreateLabel("Velocitat", 192, 8, 45, 17)
$Label7 = GUICtrlCreateLabel("Mitjana", 968, 8, 38, 17)
$Label8 = GUICtrlCreateLabel("Qualificació", 1032, 8, 59, 17)
$Label10 = GUICtrlCreateLabel("Pot. cames", 272, 8, 57, 17)
$Label11 = GUICtrlCreateLabel("Flexibilitat", 360, 8, 49, 17)
$Label12 = GUICtrlCreateLabel("Course navette", 440, 8, 76, 17)
$Label13 = GUICtrlCreateLabel("Agilitat", 720, 8, 35, 17)
$Label3 = GUICtrlCreateLabel("Test copper", 536, 8, 61, 17)
$Label14 = GUICtrlCreateLabel('Abdominals 30"', 616, 8, 78, 17)
$Label5 = GUICtrlCreateLabel("F.r.braços", 800, 8, 51, 17)
$Label6 = GUICtrlCreateLabel("Força general", 880, 8, 69, 17)

;$qt_nom2 = GUICtrlCreateInput("qt_nom1", 8, 64, 81, 21)
$Label9 = GUICtrlCreateLabel("Etapa:", 480, 32 + 32 * $num_alumnes, 35, 17)
$cb_etapa = GUICtrlCreateCombo("", 520, 32 + 32 * $num_alumnes, 89, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1r ESO|2n ESO|3r ESO|4t ESO|1r Batxillerat|2n Batxillerat", "1r ESO")
$bt_calcular = GUICtrlCreateButton("Calcular", 512, 56 + 32 * $num_alumnes, 75, 25, 0)
#EndRegion ### END Koda GUI section ###

For $i = 0 to ($num_alumnes - 1)
    $qt_nom[$i] = GUICtrlCreateInput("qt_nom1", 8, 32 + 32 * $i, 81, 21)
    $cb_noinoia[$i] = GUICtrlCreateCombo("", 104, 32 + 32 * $i, 57, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
    GUICtrlSetData(-1, "Noi|Noia", "Noi")
    $qt_velocitat[$i] = GUICtrlCreateInput("qt_velocitat1", 176, 32 + 32 * $i, 33, 21)
    $qt_nvelocitat[$i] = GUICtrlCreateInput("qt_nvelocitat1", 216, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_cames[$i] = GUICtrlCreateInput("qt_velocitat1", 264, 32 + 32 * $i, 33, 21)
    $qt_ncames[$i] = GUICtrlCreateInput("qt_nvelocitat1", 304, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_flexibilitat[$i] = GUICtrlCreateInput("qt_velocitat1", 352, 32 + 32 * $i, 33, 21)
    $qt_nflexibilitat[$i] = GUICtrlCreateInput("qt_nvelocitat1", 392, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_navette[$i] = GUICtrlCreateInput("qt_velocitat1", 440, 32 + 32 * $i, 33, 21)
    $qt_nnavette[$i] = GUICtrlCreateInput("qt_nvelocitat1", 480, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_agilitat[$i] = GUICtrlCreateInput("qt_velocitat1", 704, 32 + 32 * $i, 33, 21)
    $qt_nagilitat[$i] = GUICtrlCreateInput("qt_nvelocitat1", 744, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_copper[$i] = GUICtrlCreateInput("qt_velocitat1", 528, 32 + 32 * $i, 33, 21)
    $qt_ncopper[$i] = GUICtrlCreateInput("qt_nvelocitat1", 568, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_abdominals[$i] = GUICtrlCreateInput("qt_velocitat1", 616, 32 + 32 * $i, 33, 21)
    $qt_nabdominals[$i] = GUICtrlCreateInput("qt_nvelocitat1", 656, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_bracos[$i] = GUICtrlCreateInput("qt_velocitat1", 792, 32 + 32 * $i, 33, 21)
    $qt_nbracos[$i] = GUICtrlCreateInput("qt_nvelocitat1", 832, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_forca[$i] = GUICtrlCreateInput("qt_velocitat1", 880, 32 + 32 * $i, 33, 21)
    $qt_nforca[$i] = GUICtrlCreateInput("qt_nvelocitat1", 920, 32 + 32 * $i, 33, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_mitjana[$i] = GUICtrlCreateInput("qt_mitjana", 968, 32 + 32 * $i, 41, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
    $qt_quali[$i] = GUICtrlCreateInput("qt_mitjana", 1024, 32 + 32 * $i, 81, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
Next
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

the code it's in catalan (simmilar to spannish), but the first question it does is how long the list it must be....

by the other hand, james, for the 2nd question, i refer to make the gui like another programe does, like word, excel, notepad, and everithing you want. The gui that it makes you choice the folder and the name.

Thanks,

olivarra1

Edited by olivarra1
Link to comment
Share on other sites

the code it's in catalan (simmilar to spannish), but the first question it does is how long the list it must be....

by the other hand, james, for the 2nd question, i refer to make the gui like another programe does, like word, excel, notepad, and everithing you want. The gui that it makes you choice the folder and the name.

Got your PM.

I don't understand your questions. What problems are you having with your first issue (Scrolling GUI). Is it scrolling? It it scrolling the correct amount?

The answer to your second issue is that you have to do it yourself. There's no Save() function in AutoIt. So if you want to save the score of 89 for student Martin on assignment Pop Quiz 1, you could do it (assuming that $savepath is the path you want to save to) like:

INIWrite($savepath,"Martin","Pop Quiz 1","89")

Then later if you want to look up how Martin did on Pop Quiz 1, you could use:

INIRead($savepath,"Martin,"Pop Quiz 1","0")
and it would read the data you saved and return 89.

YES, you have to do that for each student/assignment combination. The easiest way to do it is using one array to store the student names, and another to store the assignment names. Then use a FOR...Next loop (look in the helpfile) to loop through the arrays, either writing or reading the values you want to your .ini save file.

For instance, if you had three students and two assignments (ALWAYS), you could use this:

Global $students[3]=["Mary","Mark","John"]
Global $assignments[2]=["Pop quiz 1","Final paper"]
Global $savefile=FileSaveDialog("Save","","Save files (*.ini)")
If @error Then Exit

For $i=0 to 2
  For $n=0 to 1
    IniWrite($savefile,$students[$i],$assignments[$n],Random(0,100,1))
  Next
Next

This script will create a save file for you, wherever you choose, with random scores for each of the students. Open up the file when it's done and see what it looks like.

Now, as an example on how to read (open) that save file, here's another script:

Global $students[3]=["Mary","Mark","John"]
Global $assignments[2]=["Pop quiz 1","Final paper"]
Global $savefile=FileOpenDialog("Open","","Save files (*.ini)")
If Not FileExists($savefile) Then Exit

For $i=0 to 2
  For $n=0 to 1
    MsgBox(0,"Score",$students[$i] & " got a score of " & IniRead($savefile,$students[$i],$assignments[$n],0) & " on " & $assignments[$n])
  Next
Next

See how that works? Now understand, these exact scripts would only work with three students (who must be named Mary, Mark and John), and two assignments (which must be called Pop quiz 1 and Final paper), and the scores will be random. Now, change Random(0,100,1) in that first script to something like InputBox("Score","Enter the score that "&$students[$i]&" got on "&$assignments[$n]&":"), and suddenly you could input your own scores!

There's a lot of dynamic aspects to this type of program, since you don't know at the outset how many students there will be, or number of assignments...you need to build in some way for your lists to grow. So that's up to you. This is just one way you can save your data. And remember, usually instead of either the Random() function or the InputBox() function, you'll probably be using GUICtrlRead() to get the value they've typed into an input box. Then when loading the scores, instead of displaying them in a message box, you'll need to figure out how to get the correct score into the correct box.

Do you understand the tasks ahead of you now?

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

No no no no!

1. my programe doesn't scroll with the scroll function

2. I know how to save datas, I use FileOpen...FileWriteLine and etc., but what i mean is the "GUI", pop up, that you see when you go to a programme and then menu...save. Every programme has it (the Save gui, where you can choose the folder), ScitTe, etc)

there's a picture:

Posted Image

olivarra1

Edited by olivarra1
Link to comment
Share on other sites

No no no no!

1. my programe doesn't scroll with the scroll function

2. I know how to save datas, I use FileOpen...FileWriteLine and etc., but what i mean is the "GUI", pop up, that you see when you go to a programme and then menu...save. Every programme has it (the Save gui, where you can choose the folder), ScitTe, etc)

there's a picture:

Posted Image

olivarra1

Sorry, didn't understand

FileSaveDialog() is what you're looking for.

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...