Jump to content

Problem Running a Shortcut


murdock
 Share

Recommended Posts

I have no idea why I am getting this error:

>Running:(3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\nightmist_roller.au3"

C:\Program Files\AutoIt3\nightmist_roller.au3 (31) : ==> Unable to execute the external program.:

Line 31: Run("C:\Documents and Settings\Murdock\Desktop\NMRoller.lnk")

Heres the entire script if this helps at all:

ps: Im a tad new to coding so if anyone sees some obvious ways to clean this up I would appreciate it lol

$title = "Nightmist Character Generation "

$title_manage = "Account Manager - Nightmist Solo - "

$crit_name = "Kerrigan"

$dex = 0

$con = 0

$wis = 0

$cha = 0

$total = 0

Opt("WinTitleMatchMode",2)

Opt("WinDetectHiddenText",1)

Opt("PixelCoordMode", 2)

Beginner()

While $catch = 1

RollClick()

Sleep(400)

Pixels()

Box()

CheckMath()

WEnd

Func Beginner()

Run("C:\Documents and Settings\Murdock\Desktop\NMRoller.lnk")

WinWait($title_manage,"")

If Not WinActive($title_manage,"") Then WinActivate($title_manage,"")

WinWaitActive($title_manage,"")

ControlClick($title_manage, "", "ThunderRT6CommandButton2")

WinWait($title,"")

If Not WinActive($title,"") Then WinActivate($title,"")

WinWaitActive($title,"")

;$crit_name_check = ControlGetText($title,"", ThunderRT6TextBox1)

;If $crit_name_check <> $crit_name Then

; ControlSend($title, "",ThunderRT6TextBox1, $crit_name)

; ControlClick($title, "", ThunderRT6CommandButton1)

; ControlClick($title, "", ThunderRT6OptionButton53)

;EndIf

$catch = 1

EndFunc

Func RollClick()

If NOT PixelGetColor(58,444) Then ControlClick($title, "Reroll", "ThunderRT6CommandButton3")

EndFunc

Func Pixels()

$dex_check = PixelSearch( 115, 349, 119, 353, 0xB4CA25, 30)

If Not @error Then $dex = 1

$con_check = PixelSearch( 115, 372, 119, 376, 0xD7DB47, 30)

If Not @error Then $con = 1

$wis_check = PixelSearch( 116, 393, 119, 397, 0xB3C522, 40)

If Not @error Then $wis = 1

$cha_check = PixelSearch( 114, 414, 117, 418, 0xD0BF1E, 30)

If Not @error Then $cha = 1

$total = $dex + $con + $wis + $cha

EndFunc

Func Box()

If $total > 2 Then

$catch = MsgBox(1,"oh sweet check it","oh shit dude you just got it")

Sleep(1000)

EndIf

$dex = 0

$con = 0

$wis = 0

$cha = 0

EndFunc

Func CheckMath()

If NOT PixelGetColor(439,328) Then

MouseClick( "left", 50, 50)

$catch = 0

Beginner()

EndIf

EndFunc

Edited by murdock
Link to comment
Share on other sites

have you tried ShellExecute?

I dont know if you mean thats an AutoIT function, but I am using version 3.1.1 and dont see it

http://support.microsoft.com/kb/238245

^ I am there now and am about to put that into my script (if this is what you meant, does this mean I can insert any Windows API Functions into my AutoIT scripts?)

C:\Program Files\AutoIt3\nightmist_roller.au3 (31) : ==> Unknown function name.:

ShellExecute("C:\Documents and Settings\Murdock\Desktop\NMRoller.lnk")

:-/

Edited by murdock
Link to comment
Share on other sites

Ok I downloaded the latest version, and it has ShellExecute

I no longer get the error... but it doesn't run the shortcut...

Edit: nvm got it. I still dont understand why it doesnt run the shortcut though :)

Edited by murdock
Link to comment
Share on other sites

Are you sure you are doing it right? It has to work... And why don't you just run the program the shortcut links to?

Yes I'm sure its right. No errors pop up, the syntax is correct, but nothing happens.

I'm just gonna work around it with either:

a ) _RunDos

b ) If I cant get that to work, Ill just make a batch script

I can't run the executable because the shortcut has parameters in it that include login information.

Edited by murdock
Link to comment
Share on other sites

Maybe you could try either of these 2 ways .. may not work no harm in trying.

$FGS = FileGetShortcut(@DesktopDir & "\NMRoller.lnk")
If Not @error And FileExists($FGS[0]) Then
    ShellExecute($FGS[0], $FGS[2], $FGS[1], "open", @SW_SHOW)
EndIfoÝ÷ ÚÚºÚ"µÍÌÍÑÔÈH[QÙ]ÚÜÝ]
ÚÝÜ  [È ][ÝÉÌLÓTÛÉ][ÝÊBYÝÜ[[Q^ÝÊ    ÌÍÑÔÖÌJH[[    ÌÍÑÔÖÌH   [È ][ÝÈ  ][ÝÈ  [È ÌÍÑÔÖÌK   ÌÍÑÔÖÌWKÕ×ÔÒÕÊB[Y

Cheers

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