Sign in to follow this  
Followers 0
ARIrish

A couple more inputbox questions

9 posts in this topic

#1 ·  Posted (edited)

I've had a search through the helpfile, and a quick look on the forums, but I couldn't seem to find anything about this:

I've edited a very simple code to eject my CD drive of choice, as follows:

$CD = Inputbox("Open CD Drive", "Type drive letter:", "D", "", 50, 25, 500, 200)&":"

CDtray(""&$CD&"", "OPEN")

However, I want this to appear in a dialog with no system icon (top left corner) and no close button (top right). How can I make this happen?

Also, when the script runs, I'd like the inputbox to get focus, but by default it doesn't seem to. Again, nothing in the help file as far as I could see.

Sorry if I've just overlooked something, but I'd appreciates some pointers on this, as they are things I'll probably be using a lot.#

EDIT: I just found this and put it into my code, but it doesn't seem to be working:

WinActivate ( "Open CD Drive")

Edited by thehyraxlord

Share this post


Link to post
Share on other sites



For what you need you will need to make your own GUI with a Input field. This way you can make the window with no system icon or close buttons. Also it will be easy to activate the window by using winactivate or you can even use SetOnTop function...Try it out...Post some code if u still need help....

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For what you need you will need to make your own GUI with a Input field. This way you can make the window with no system icon or close buttons. Also it will be easy to activate the window by using winactivate or you can even use SetOnTop function...Try it out...Post some code if u still need help....

And a note on your initial code, in the line:

CDtray(""&$CD&"", "OPEN")

The quotes aren't needed around your variable $CD (I'm assuming you were trying to emulate the example in the help file with your variable modification. If so, kudos for actually reading it!)

You could, instead, just use:

CDTray($CD,"OPEN")
Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

For what you need you will need to make your own GUI with a Input field. This way you can make the window with no system icon or close buttons. Also it will be easy to activate the window by using winactivate or you can even use SetOnTop function...Try it out...Post some code if u still need help....

Thanks - I saw the GUICreate stuff and thought I might have to go that way. I'll try some stuff out.

Share this post


Link to post
Share on other sites

And a note on your initial code, in the line:

CDtray(""&$CD&"", "OPEN")

The quotes aren't needed around your variable $CD (I'm assuming you were trying to emulate the example in the help file with your variable modification. If so, kudos for actually reading it!)

You could, instead, just use:

CDTray($CD,"OPEN")
Thanks for the tip. I'll bear it in mind for the future.

Share this post


Link to post
Share on other sites

Here's a quick and dirty GUI example:

#include <GUIConstants.au3>

GUICreate("CDROM Ejector", 250, 100, 20, 20, $DS_MODALFRAME)

Dim $templist = ""
$DrivesArr = DriveGetDrive("CDROM")
If Not @error Then
    If $DrivesArr[0] > 1 Then
        For $i = 1 To $DrivesArr[0]
            $j = $DrivesArr[$i] & "|"
            $templist = $templist & $j
        Next
    Else
        $templist = $DrivesArr[1]
    EndIf
    If StringRight($templist, 1) = "|" Then $templist = StringTrimRight($templist, 1)
EndIf

GUICtrlCreateLabel("Select the drive letter to eject:", 5, 15, 150, 20)
$AvailDrives = GUICtrlCreateCombo("", 160, 10, 75, 20)
GUICtrlSetData($AvailDrives,StringUpper($templist))
$ButtonEject = GUICtrlCreateButton("Eject", 75, 40, 100, 20)

GUISetState()

WinActivate("CDROM Ejector","Select the drive letter")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $ButtonEject
            CDTray(GUICtrlRead($AvailDrives),"OPEN")
            Exit
    EndSelect
WEnd

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Here's a quick and dirty GUI example:

#include <GUIConstants.au3>

GUICreate("CDROM Ejector", 250, 100, 20, 20, $DS_MODALFRAME)

Dim $templist = ""
$DrivesArr = DriveGetDrive("CDROM")
If Not @error Then
    If $DrivesArr[0] > 1 Then
        For $i = 1 To $DrivesArr[0]
            $j = $DrivesArr[$i] & "|"
            $templist = $templist & $j
        Next
    Else
        $templist = $DrivesArr[1]
    EndIf
    If StringRight($templist, 1) = "|" Then $templist = StringTrimRight($templist, 1)
EndIf

GUICtrlCreateLabel("Select the drive letter to eject:", 5, 15, 150, 20)
$AvailDrives = GUICtrlCreateCombo("", 160, 10, 75, 20)
GUICtrlSetData($AvailDrives,StringUpper($templist))
$ButtonEject = GUICtrlCreateButton("Eject", 75, 40, 100, 20)

GUISetState()

WinActivate("CDROM Ejector","Select the drive letter")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $ButtonEject
            CDTray(GUICtrlRead($AvailDrives),"OPEN")
            Exit
    EndSelect
WEnd
That's great! Thanks a lot! I'll be sure and read through it and see if I can't figure it out.

Share this post


Link to post
Share on other sites

I had the same problem here with inputbox, so I tryd to make another GUI, called by my main GUI...but my second GUI that should be like the inputbox remain freezed.

I read about "winactivate" but I do not understand how to use it properly. Any tips? :)

Share this post


Link to post
Share on other sites

I had the same problem here with inputbox, so I tryd to make another GUI, called by my main GUI...but my second GUI that should be like the inputbox remain freezed.

I read about "winactivate" but I do not understand how to use it properly. Any tips?

Look in the help file for child windows and GUISwitch is what you need to use.

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