Jump to content

Run then close?


Recommended Posts

Ok so I wrote this simple code...

#include <GUIListBox.au3>
$list = ProcessList()
Start()

Func Start()
Global $Form
$Form1 = GUICreate($Form1, 633, 447, 193, 125)
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create ("Form1", "", 2, 2, 396, 296)
    GUICtrlSetData(-1, ""&$list)
EndFunc

All I want it to do right now is list the processes. I open it, and I get an error that says

Error: Variable used without being declared.

:)
Link to comment
Share on other sites

i see your problem your using the variable $Form1 in the same line as your delcaring which will not work as you see the error message you recieved..... plus your using a variable as the titel of your script a very simple mistake just remove the $ in front of form1 like this:

#include <GUIListBox.au3>
$list = ProcessList()
Start()

Func Start()
Global $Form
$Form1 = GUICreate(Form1, 633, 447, 193, 125); changes made here to $form1 now is form1 a titel not a variable
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create ("Form1", "", 2, 2, 396, 296)
    GUICtrlSetData(-1, ""&$list)
EndFunc

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

found another error as well you forgot " around the titel here:

#include <GUIListBox.au3>
$list = ProcessList()
Start()

Func Start()
Global $Form
$Form1 = GUICreate("Form1", 633, 447, 193, 125);added quote
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create ("Form1", "", 2, 2, 396, 296)
    GUICtrlSetData(-1, ""&$list)
EndFunc

wow i found another error that i hope fixes your sript here:

#include <GUIListBox.au3>
$list = ProcessList()
Start()

Func Start()
Global $Form
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create ("Form1",  396, 296, 2, 2);<----------- you had the 2's switched around with the 396 and 296 i think its in right order now
    GUICtrlSetData(-1, ""&$list)
EndFunc
Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

  • Developers

do you understand what im saying?

Whats the idea here posting 4 replies in a row ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Whats the idea here posting 4 replies in a row ?

i removed them

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

it still isnt working even in correct format..hmmm look at this example script a friend sent to me it may have solutions to your problem

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

;Creating the GUI
GuiCreate("MyGUI", 384, 240,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

;Creating all of the buttons/inputs/labels
$incomel = GuiCtrlCreateLabel("Weekly income:", 10, 10, 80, 20)
$income = GuiCtrlCreateInput("", 100, 10, 240, 20)
$expenl = GuiCtrlCreateLabel("Weekly expenses:", 10, 40, 90, 20)
$expen = GuiCtrlCreateInput("0", 100, 40, 240, 20)
$samtl = GuiCtrlCreateLabel("Starting amount:", 10, 70, 90, 20)
$samt = GuiCtrlCreateInput("0", 100, 70, 240, 20)
$weeksl = GuiCtrlCreateLabel("Weeks:", 10, 100, 80, 20)
$weeks = GuiCtrlCreateInput("", 100, 100, 240, 20)
$youwillhavel = GuiCtrlCreateLabel("You will have: 0$", 10, 130, 370, 20)
$statusl = GuiCtrlCreateLabel("You will be a(n): Hobo", 10, 160, 360, 20)
$calc = GuiCtrlCreateButton("Calculate", 100, 190, 180, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    ;If you press Calculate
    Case $msg = $calc
    ;Reading the input boxes
        $inc = GUICtrlRead($income)
        $exp = GUICtrlRead($expen)
        $startamt = GUICtrlRead($samt)
        $weekn = GUICtrlRead($weeks)
    ;Calculating the profit
        $prof = ($inc*$weekn)-($exp*$weekn)+$startamt
    ;Changing the Profit display
        GUICtrlSetData($youwillhavel,"You will have: " & $prof)
    ;Deciding on what you'll be
    ;Select is like If and Elseif, except that it uses select and case.
        Select
        ; <= means less than or equal to
            Case $prof <= 100
                GUICtrlSetData($statusl,"You will be a(n): Hobo")
            case $prof > 100 AND $prof <= 200
                GUICtrlSetData($statusl,"You will be a(n): Burger flipper")
            case $prof > 200 AND $prof <= 1000
                GUICtrlSetData($statusl,"You will be a(n): Assembly line worker")
            case $prof > 1000 AND $prof <= 10000
                GUICtrlSetData($statusl,"You will be a(n): Teacher")
            case $prof > 10000 AND $prof <= 50000
                GUICtrlSetData($statusl,"You will be a(n): Trucker")
            case $prof > 50000 AND $prof <= 200000
                GUICtrlSetData($statusl,"You will be a(n): Lawyer")
            case $prof > 200000 AND $prof <= 1000000
                GUICtrlSetData($statusl,"You will be a(n): CEO")
            case $prof > 1000000 AND $prof <= 1000000000
                GUICtrlSetData($statusl,"You will be a(n): Millionaire")
            case $prof > 1000000000 AND $prof <= 1000000000000
                GUICtrlSetData($statusl,"You will be a(n): Billionaire")
            case $prof > 1000000000000
                GUICtrlSetData($statusl,"You will be a(n): Kajillionaire")
        EndSelect
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

hmm ill mess around with your script for a while and ill see if i can figure out your problem ill be back soon meanwhile check the helpfile if u need to

Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

hmm ill mess around with your script for a while and ill see if i can figure out your problem ill be back soon meanwhile check the helpfile if u need to

I've been checking :)

#include <GUIConstants.au3>

there

???

Link to comment
Share on other sites

made a little progress but i now have a new error message at last line which means once we fix this your script will function check new script out:

#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
$list = ProcessList()
Start()

Func Start()
Global $Form
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create("Form1", "String upon creation", 2, 2, 396, 296)
    GUICtrlSetData("-1, ""&$list)
    Terminate(GUICtrlSetData("-1, ""&$list))
EndFunc

the error message states:GUICtrlSetData("-1, ""&$list) not terminated so try it out and see if you have any ideas

i fixed problem u forgot quotes agian around the GUICtrlSetData("-1, ""&$list) quotes go behind $list in line like this GUICtrlSetData("-1, ""&$list")

but now im back to first perimiter error message ill work on the script tomorrow and help u later

Edited by TnTProductions

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

Ok its finally done but it doesnt display anything since you havent listed any items but i fixed all ur errors so just add things to list on ur display table

#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
$list = ProcessList()
Start()

Func Start()
Global $hGUI
$hGUI = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296)
    GUICtrlSetData(-1, $hGUI)
    
EndFunc

i felt generous to help because i was like this once to and no one helped me much so have fun with autoit 3 its the easiest scripter out there

"FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"

Link to comment
Share on other sites

OK. That kind of works. I get the thing open without errors, but there are no process' located in the ListBox.

EDIT: The Sleep(10000) just makes it not close... Is there any way I can keep it open without that?

Edited by Hok
Link to comment
Share on other sites

Wow. Thanks!

EDIT: There are some wierd options though.... There is a close button, and a Text Selected Button. Also, when I close it, it flashes the old GUI for a second before closing.

Edited by Hok
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...