Sign in to follow this  
Followers 0
MattX

What the hell ?

6 posts in this topic

#1 ·  Posted (edited)

For the love of god, will someone please tell me why the hell after this script runs and after NO input from the user the line:

Run('p:\Misc\box.exe')

is run ? In fact it just runs and runs and runs and keeps running until I log off the PC !!

If I rem the line out the script runs without a problem, stick it back in [ with any pointer to an exe and it keeps launching the exe ] God knows why, what am I missing ? I have used this script for almost a year and have updated it often - now its unusable because of this bug and its driving me crazy trying to work out why... I would apprecate any help:

[ please tell me its got nothing to do with the compiler as I recently up-dated to 3.2.0.1 from 3.10 ] if so what do I do ?

#include <GuiConstants.au3>

GUICreate("Quick Launcher", 223, 220, 750, 40)
$helpmenu = GUICtrlCreateMenu("Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)
GUISetBkColor(0x0066FF)

$Icon_1 = GUICtrlCreateIcon("C:\Program Files\Mozilla Firefox v1\firefox.exe", 0, 20, 10, 32, 32)
GUICtrlCreateLabel("Firefox", 20, 45)
GUICtrlSetTip(-1, "Launch Firefox For Internet Access")
$Icon_2 = GUICtrlCreateIcon("c:\Windows\explorer.exe", 0, 90, 10, 32, 32)
GUICtrlCreateLabel("File Manager", 80, 45)
GUICtrlSetTip(-1, "Manage Your Files")
$Icon_3 = GUICtrlCreateIcon(@ScriptDir & "\email3.ico", 0, 160, 10, 32, 32)
GUICtrlCreateLabel("E-Mail", 160, 45)
GUICtrlSetTip(-1, "Check Your E-mail")
$Icon_4 = GUICtrlCreateIcon("C:\FreewayEd\icons\class16.ico", 0, 20, 80, 32, 32)
GUICtrlCreateLabel("Classroom", 10, 120)
GUICtrlCreateLabel("   Library", 10, 135)
GUICtrlSetTip(-1, "Freeway Video Clip" & @CRLF & "Library")
$Icon_5 = GUICtrlCreateIcon("C:\Program Files\ACTIV Software\ACTIVpx 3\APX3.EXE", 0, 90, 80, 32, 32)
GUICtrlCreateLabel("  ActivPX", 80, 120)
;GUICtrlCreateLabel("1024x768", 80, 135)
GUICtrlSetTip(-1, "Launch Active Board" & @CRLF & "Software")
$Icon_6 = GUICtrlCreateIcon("\\server\facilitycmis$\admin\admin.exe", 0, 160, 80, 32, 32)
GUICtrlCreateLabel("Facility", 160, 120)
;GUICtrlCreateLabel("Facility Admin", 140, 135)
GUICtrlSetTip(-1, "Launch Facility Admin.")
$Date_7 = GUICtrlCreateDate("Date7", 20, 170, 120, 20)
GUISetState(@SW_SHOW)

While 1
    $bpress = GUIGetMsg()
    Select
        Case $bpress = $Icon_1
            Run('p:\Misc\firefox launcher google.exe')
        Case $bpress = $Icon_2
            Run('c:\windows\explorer.exe')
        Case $bpress = $Icon_3
            Run('p:\update\firefox launcher3.exe')
        Case $bpress = $Icon_4
            Run('p:\Misc\box.exe')
        Case $bpress = $Icon_5
            Run('C:\Program Files\ACTIV Software\ACTIVpx 3\APX3.exe', 'C:\Program Files\ACTIV Software\ACTIVpx 3')
        Case $bpress = $Icon_6
            Run('p:\misc\facility admin.exe')
        Case $bpress = $infoitem
            MsgBox(0, "Quick Launcher v2.1", "Quick Launcher v2.1" & @CRLF & "Written By Matt Marsh." & @CRLF & "" & @CRLF & "Comments & Suggestions to:" & @CRLF & "mmarsh@sorg.uk")
            
    EndSelect
WEnd
Edited by MattX

Share this post


Link to post
Share on other sites



the icons will return their name to GUIgetmsg() causing them to repetedly run the program. you should probably make buttons with the icons ontop if you want them to be pressable... also try using a workingdir in the run statements.

Run(@WindowsDir&"\explorer.exe","")

> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The reason it keeps running that program is because GUIGetMsg() = 0 and $Icon_4 = 0 (Meaning, there is no Icon). On my system, only 1 icon showed up (the 2nd one) and all the rest returned 0 (and I have firefox).

Edit:

Might want to make a conditional statement just incase the icons aren't there.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

The reason it keeps running that program is because GUIGetMsg() = 0 and $Icon_4 = 0 (Meaning, there is no Icon). On my system, only 1 icon showed up (the 2nd one) and all the rest returned 0 (and I have firefox).

Edit:

Might want to make a conditional statement just incase the icons aren't there.

Thanks for the replies, this does not make any sence to me though, I just changed the:

$Icon_4 = GUICtrlCreateIcon(@ScriptDir & "\class16.ico", 0, 20, 80, 32, 32)

So the icon is now a .ico file and not the exe file - the prog is now trying to fire off the next line as a prog:

$Icon_5 = GUICtrlCreateIcon("C:\Program Files\ACTIV Software\ACTIVpx 3\APX3.EXE", 0, 90, 80, 32, 32)

Why does it not try this on the first Icon ? The:

$Icon_1 = GUICtrlCreateIcon("C:\Program Files\Mozilla Firefox v1\firefox.exe", 0, 20, 10, 32, 32)

- this was working perfectly well before - why the hell is it mis-behaving now ?

Share this post


Link to post
Share on other sites

As I stated... If the icon isn't visible, then the value is 0.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It seems the icons were all the problems - now changed the code so two icons that I had GUICtrlCreateIcon pointing to an exe are now pointing to ICOs....

I find it odd though how its been working all this time but a single edit put a spanner in the works....

The code certainly needs a tidy, maybe a few constraints just in case certain exe are not located - before nothing would happen if the exe was not found on the PCs - now the script exits if you click on a icon with no path to the exe...

Anyway - thank for the advice - final code [ not much has changed ]

#include <GuiConstants.au3>

GUICreate("Quick Launcher", 223, 220, 750, 40)
$helpmenu = GUICtrlCreateMenu("Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)
GUISetBkColor(0x0066FF)

$Icon_1 = GUICtrlCreateIcon("C:\Program Files\Mozilla Firefox v1\firefox.exe", 0, 20, 10, 32, 32)
GUICtrlCreateLabel("Firefox", 20, 45)
GUICtrlSetTip(-1, "Launch Firefox For Internet Access")
$Icon_2 = GUICtrlCreateIcon("c:\Windows\explorer.exe", 0, 90, 10, 32, 32)
GUICtrlCreateLabel("File Manager", 80, 45)
GUICtrlSetTip(-1, "Manage Your Files")
$Icon_3 = GUICtrlCreateIcon(@ScriptDir & "\email3.ico", 0, 160, 10, 32, 32)
GUICtrlCreateLabel("E-Mail", 160, 45)
GUICtrlSetTip(-1, "Check Your E-mail")
$Icon_4 = GUICtrlCreateIcon(@ScriptDir & "\class16.ico", 0, 20, 80, 32, 32)
GUICtrlCreateLabel("Classroom", 10, 120)
GUICtrlCreateLabel("   Library", 10, 135)
GUICtrlSetTip(-1, "Freeway Video Clip" & @CRLF & "Library")
$Icon_5 = GUICtrlCreateIcon(@ScriptDir & "\APX3.ico", 0, 90, 80, 32, 32)
GUICtrlCreateLabel("  ActivPX", 80, 120)
;GUICtrlCreateLabel("1024x768", 80, 135)
GUICtrlSetTip(-1, "Launch Active Board" & @CRLF & "Software")
$Icon_6 = GUICtrlCreateIcon("\\server\facilitycmis$\admin\admin.exe", 0, 160, 80, 32, 32)
GUICtrlCreateLabel("Facility", 160, 120)
;GUICtrlCreateLabel("Facility Admin", 140, 135)
GUICtrlSetTip(-1, "Launch Facility Admin.")
$Date_7 = GUICtrlCreateDate("Date7", 20, 170, 120, 20)
GUISetState(@SW_SHOW)

While 1
    $bpress = GUIGetMsg()
    Select
        Case $bpress = $Icon_1
            Run('p:\Misc\firefox launcher google.exe')
        Case $bpress = $Icon_2
            Run('c:\windows\explorer.exe')
        Case $bpress = $Icon_3
            Run('p:\update\firefox launcher3.exe')
        Case $bpress = $Icon_4
            Run('p:\Misc\freeway classroom.exe')
        Case $bpress = $Icon_5
            Run('C:\Program Files\ACTIV Software\ACTIVpx 3\APX3.exe', 'C:\Program Files\ACTIV Software\ACTIVpx 3')
        Case $bpress = $Icon_6
            Run('p:\misc\facility admin.exe')
        Case $bpress = $infoitem
            MsgBox(0, "Quick Launcher v2.2", "Quick Launcher v2.2" & @CRLF & "Written By Matt Marsh." & @CRLF & "" & @CRLF & "Comments & Suggestions to:" & @CRLF & "mmarsh@org.uk")
            
    EndSelect
WEnd
Edited by MattX

Share this post


Link to post
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
Sign in to follow this  
Followers 0