Sign in to follow this  
Followers 0
SoBEIT

Radio Button/Install Button to Initiate Other Scripts

5 posts in this topic

Hi AutoIt Forum!

I've got a script which displays a list of radio buttons (with names of printers beside them) and an install and exit button.

I want to be able to select a radio button and then click the install button to initiate some other scripts/instructions which will be connected to that button and I will write these scripts/instructions inside the main script to map a network drive, extract the drivers to a local folder and then go through the motions of adding a printer.

I'm not sure how to get the radio button and install button to link together and start running sub-scripts - any advice?

So far I have...

**********************

;AutoIt Script

;Installation of RICOH Aficio photocopiers

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

DriveMapAdd ("I:", "\\IP ADDRESS\SHARE", 0, "USERNAME", "PASSWORD")

$ParentWin = GUICreate("Photocopier Installer", 300, 300)

GUICtrlCreateGroup("Please select a photocopier to install:", 20, 20, 260, 200)

$1075 = GUICtrlCreateRadio("RICOH Aficio 1075", 25, 40, 125)

$1232C = GUICtrlCreateRadio("RICOH Aficio 1232C", 25, 65, 125)

$2051 = GUICtrlCreateRadio("RICOH Aficio 2051", 25, 90, 125)

$2075S = GUICtrlCreateRadio("RICOH Aficio 2075 (SoBE)", 25, 115, 150)

$2075X = GUICtrlCreateRadio("RICOH Aficio 2075 (Xfi)", 25, 140, 150)

$2090 = GUICtrlCreateRadio("RICOH Aficio 2090", 25, 165, 125)

$5560 = GUICtrlCreateRadio("RICOH Aficio Color 5560", 25, 190, 150)

$InstallButton = GUICtrlCreateButton("Install", 20, 250, 100, 25)

$ExitButton = GUICtrlCreateButton("Exit", 180, 250, 100, 25)

GUICtrlSetOnEvent($ExitButton, "OnExitButton")

GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton")

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

Func OnExitButton()

GUIDelete($ParentWin)

Exit

EndFunc

**********************

Share this post


Link to post
Share on other sites



Hi AutoIt Forum!

I've got a script which displays a list of radio buttons (with names of printers beside them) and an install and exit button.

I want to be able to select a radio button and then click the install button to initiate some other scripts/instructions which will be connected to that button and I will write these scripts/instructions inside the main script to map a network drive, extract the drivers to a local folder and then go through the motions of adding a printer.

I'm not sure how to get the radio button and install button to link together and start running sub-scripts - any advice?

So far I have...

;AutoIt Script
;Installation of RICOH Aficio photocopiers

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

DriveMapAdd ("I:", "\\IP ADDRESS\SHARE", 0, "USERNAME", "PASSWORD")

$ParentWin = GUICreate("Photocopier Installer", 300, 300)
GUICtrlCreateGroup("Please select a photocopier to install:", 20, 20, 260, 200)
$1075 = GUICtrlCreateRadio("RICOH Aficio 1075", 25, 40, 125)
$1232C = GUICtrlCreateRadio("RICOH Aficio 1232C", 25, 65, 125)
$2051 = GUICtrlCreateRadio("RICOH Aficio 2051", 25, 90, 125)
$2075S = GUICtrlCreateRadio("RICOH Aficio 2075 (SoBE)", 25, 115, 150)
$2075X = GUICtrlCreateRadio("RICOH Aficio 2075 (Xfi)", 25, 140, 150)
$2090 = GUICtrlCreateRadio("RICOH Aficio 2090", 25, 165, 125)
$5560 = GUICtrlCreateRadio("RICOH Aficio Color 5560", 25, 190, 150)
$InstallButton = GUICtrlCreateButton("Install", 20, 250, 100, 25)
$ExitButton = GUICtrlCreateButton("Exit", 180, 250, 100, 25)
GUICtrlSetOnEvent($ExitButton, "OnExitButton")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExitButton")
GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func OnExitButton()
    GUIDelete($ParentWin)
    Exit
EndFuncoÝ÷ Ûú®¢×¬7þÊZû"Íç+&k("½ì¨¹«-j»ZºÚ"µÍÐ]]Ò]ØÜÒ[Ý[][ÛÙPÓÒYXÚ[ÈÝØÛÜYÂÚ[ÛYH    ÑÕRPÛÛÝ[Ë]LÉÝÂÜ
    ][ÝÑÕRSÛ][[ÙI][ÝËJB[H    ÌÍÔÙ[XÝY]XÙHH ][ÝÉ][ÝÂÑ]SXY
    ][ÝÒN][ÝË   ][ÝÉÌLÉÌLÒTQTÔÉÌLÔÒTI][ÝË  ][ÝÕTÑTSQI][ÝË ][ÝÔTÔÕÓÔ ][ÝÊBÌÍÔ[Ú[HÕRPÜX]J ][ÝÔÝØÛÜY[Ý[][ÝËÌÌ
BÕRPÝÜX]QÜÝ
    ][ÝÔXÙHÙ[XÝHÝØÛÜYÈ[Ý[][ÝË
BÌÍÌL
ÍHHÕRPÝÜX]TY[Ê ][ÝÔPÓÒYXÚ[ÈL
ÍI][ÝËK
LJBÌÍÌLÌÈHÕRPÝÜX]TY[Ê  ][ÝÔPÓÒYXÚ[ÈLÌÉ][ÝËK
KLJBÌÍÌ
LHHÕRPÝÜX]TY[Ê  ][ÝÔPÓÒYXÚ[È
LI][ÝËKLLJBÌÍÌ
ÍTÈHÕRPÝÜX]TY[Ê   ][ÝÔPÓÒYXÚ[È
ÍH
ÛÐJI][ÝËKLMKML
BÌÍÌ
ÍVHÕRPÝÜX]TY[Ê ][ÝÔPÓÒYXÚ[È
ÍH
JI][ÝËKMML
BÌÍÌLHÕRPÝÜX]TY[Ê    ][ÝÔPÓÒYXÚ[ÈL ][ÝËKMKLJBÌÍÍMMHÕRPÝÜX]TY[Ê    ][ÝÔPÓÒYXÚ[ÈÛÛÜ
MM  ][ÝËKNLML
BÌÍÒ[Ý[]ÛHÕRPÝÜX]P]Û   ][ÝÒ[Ý[  ][ÝËLLJBÌÍÑ^]]ÛHÕRPÝÜX]P]Û    ][ÝÑ^]    ][ÝËNLLJBÕRPÝÙ]Û][
    ÌÍÑ^]]Û ][ÝÓÛ^]]Û][ÝÊBÕRPÝÙ]Û][
    ÌÍÒ[Ý[]Û   ][ÝÓÛ[Ý[]Û][ÝÊBÕRTÙ]Û][
    ÌÍÑÕRWÑUSÐÓÔÑK ][ÝÓÛ^]]Û][ÝÊBÕRTÙ]Ý]JÕ×ÔÒÕÊBÚ[HBIÌÍÛÙÈHÕRQÙ]ÙÊ
BRY ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑH[^]ÛÜÑ[[ÈÛ^]]Û
BQÕRQ[]J   ÌÍÔ[Ú[BQ^][[ÈÏOIÝÓÛ^]]Û[ÈÛ[Ý[]Û
BIÌÍÔÙ[XÝY]XÙHHÑÙ]Ù[XÝY]XÙJ
BRY ÌÍÔÙ[XÝY]XÙH  ÉÝÈ  ][ÝÉ][ÝÈ[BWÒ[Ý[ÚÜÊ
BQ[Y[[ÈÏOIÝÓÛ[Ý[]Û[ÈÑÙ]Ù[XÝY]XÙJ
BTÙ[XÝBPØÙHÕRPÝXY
    ÌÍÌL
ÍJHH   ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌL
ÍHÙ[XÝY  ][ÝÂBPØÙHÕRPÝXY
    ÌÍÌLÌÊHH   ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌLÌÈÙ[XÝY  ][ÝÂBPØÙHÕRPÝXY
    ÌÍÌ
LJHH    ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌ
LHÙ[XÝY   ][ÝÂBPØÙHÕRPÝXY
    ÌÍÌ
ÍTÊHH ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌ
ÍTÈÙ[XÝY    ][ÝÂBPØÙHÕRPÝXY
    ÌÍÌ
ÍV
HH  ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌ
ÍVÙ[XÝY  ][ÝÂBPØÙHÕRPÝXY
    ÌÍÌL
HH  ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÌLÙ[XÝY  ][ÝÂBPØÙHÕRPÝXY
    ÌÍÍMM
HH  ÌÍÑÕRWÐÒPÒÑQBBT]    ][ÝÍMMÙ[XÝY ][ÝÂBPØÙH[ÙBQ[Ù[XÝ[[ÂBBB[ÈÒ[Ý[ÚÜÊ
BNÈÜHÚÜÈHÙYÛH    ÌÍÔÙ[XÝY]XÙHXXBSÙÐÞ
    ][ÝÐXÝ]H[Ù[XÝ[Û][ÝË ÌÍÔÙ[XÝY]XÙJB[[ÈÏOIÝ×Ò[Ý[ÚÜ

- 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

Thanks Monamo!

After a few tweaks to your suggestion I've managed to get the script to install the correct printer drivers depending on which radio button is selected, now all I have to do is write the script for the installation of the printers themselves.

One thing I'm still having a problem with is running a .exe file from a remote location i.e. I want to store the script on a USB keyring so that when it's run it maps a network drive and then runs the .exe file from a certain folder on a network storage device.

The mapped network drive will always be "I:\IP ADDRESS\SHARE" but the drivers are stored in a folder which once connected to, shows as "I:\Drivers\Photocopiers" and when I used the command Run("1075_RPCS.exe", "I:\Drivers\Photocopiers") it doesn't do anything?

Everything seems to be OK and the drive maps without any problems!

Regards,

SoBEIT

Share this post


Link to post
Share on other sites

Are you getting a fatal error? It says it can't find the external program, or it just does nothing?

Try this:

Run( "I:\Drivers\Photocopiers\1075_RPCS.exe")

Share this post


Link to post
Share on other sites

Thanks Nahuel!

Changing the command from Run("1075_RPCS.exe", "I:\Drivers\Photocopiers") to Run("I:\Drivers\Photocopiers\1075_RPCS.exe") worked! <_<

The orginally command was what I extracted from the AutoIt user guide, maybe it's only to be used for local files?

Regards,

SoBEIT

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