Sign in to follow this  
Followers 0
AzKay

Why Wont You Run?!

22 posts in this topic

#NoTrayIcon
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("RunErrorsFatal", 0)
### Koda GUI section start ###
$Form1 = GUICreate("Convert", 262, 40, 193, 126)
$Button1 = GUICtrlCreateButton("Hex2String", 8, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
$Button2 = GUICtrlCreateButton("String2Hex", 136, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton2Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)
### Koda GUI section end   ###

FileOpen("Credits.txt", 2)
FileWrite("Credits.txt", "Hex2String & String2Hex were created by Azkay"  & @CR & "With help from the AutoIt Forum: http://www.autoitscript.com/forum/index.php" & @CR & "MSN: Final_Fantasie_2@hotmail.com" & @CR & "EMAIL: Azkay.s@gmail.com")
FileClose("Credits.txt")

While 1
    Sleep(100)
WEnd

Func AButton1Click()
    Run("Hex2String.exe")
    If @Error = 1 Then 
    MsgBox(0, "Error", "Make sure Hex2String.exe is in your Converter directory")
    EndIf
EndFunc

Func AButton2Click()
    Run("String2Hex.exe")
    If @Error = 1 Then
    MsgBox(0, "Error", "Make sure String2Hex.exe is in your Converter directory")
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc

Why wont it run the other 2 apps?

I think I remember somewhere something about, autoit not being able to open other autoit programs, is this true?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Is convertor a subdirectory of where the script is or is the script in the convertor directory too? Also try:

Run(@ScriptDir & "\Hex2String.exe")

and

Run(@ScriptDir & "\String2Hex.exe")

Edit: Autoit can open compiled autoit scripts no problem. At least for me...

Edited by BPBNA

Share this post


Link to post
Share on other sites

Tryed that already, There all in the same directory.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I just tryed

$Dir = IniRead("Config.ini", "Directory", "Dir", "")
    _RunDOS("Start " & $Dir & "\" & "Hex2String.exe")

But, when I click the button, nothing happens ><


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I just tryed

$Dir = IniRead("Config.ini", "Directory", "Dir", "")
    _RunDOS("Start " & $Dir & "" & "Hex2String.exe")
 oÝ÷ ح§!ÉbrKay»­¶ç¢ØbZ¦§²e·ú®¢×¡ë4ß â­Ê'µ¨§²zÄëÊØb±«­¢+ØÀÌØí¥Èô%¹¥I ÅÕ½Ðí
½¹¥¹¥¹¤ÅÕ½Ðì°ÅÕ½Ðí¥ÉѽÉäÅÕ½Ðì°ÅÕ½Ðí¥ÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤(IÕ¸ ÌäìÅÕ½ÐìÌäìµÀìÀÌØí¥ÈµÀìÌäìÀäÈìÌäìµÀìÌäí!àÉMÑÉ¥¹¹áÅÕ½ÐìÌäì¤

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

No spaces in it, and that one, just gives me my msgbox error


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Well I got no errors when I placed them in the right directory and ran a test.exe like this:

#NoTrayIcon
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("RunErrorsFatal", 0)
Global $CreditsTxt = @ScriptDir & "\Credits.txt"
$Form1 = GUICreate("Convert", 262, 40, 193, 126)
$Button1 = GUICtrlCreateButton("Hex2String", 8, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
$Button2 = GUICtrlCreateButton("String2Hex", 136, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton2Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)

If FileExists($CreditsTxt) Then
    $hFile = FileOpen($CreditsTxt, 2)
    FileWrite($CreditsTxt, "Hex2String & String2Hex were created by Azkay"  & @CR _
            & "With help from the AutoIt Forum: http://www.autoitscript.com/forum/index.php" & @CR _
            & "MSN: Final_Fantasie_2@hotmail.com" & @CR & "EMAIL: Azkay.s@gmail.com")
    FileClose($hFile)
EndIf

While 1
    Sleep(100)
WEnd

Func AButton1Click()
    If FileExists(@ScriptDir & "\Hex2String.exe") Then Return Run('"' & @ScriptDir & '\Hex2String.exe"');This way you could return the PID if you wanted
    MsgBox(0, "Error", "Make sure Hex2String.exe is in your Converter directory")
    Return 0
EndFunc

Func AButton2Click()
    If FileExists(@ScriptDir & "\String2Hex.exe") Then Return Run('"' & @ScriptDir & '\String2Hex.exe"')
    MsgBox(0, "Error", "Make sure String2Hex.exe is in your Converter directory")
    Return 0
EndFunc

Func Quit()
    Exit
EndFunc

Edit:

Also, isn't there already functions that for strings and hex (_StringToHex()/_HexToString()), what does yours do differently I'm curious :D ?

Changed to my other edit.

Edit2:

Forgot a "Then"

Edit3:

Have it returning the PID of the Run/Control just for good measure lol.

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

Works ^^


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

No spaces in it, and that one, just gives me my msgbox error

What is the output of this?

$Dir = IniRead("Config.ini", "Directory", "Dir", "")
If FileExists($Dir & "\Hex2String.exe") Then
    Run('"' & $Dir & '\Hex2String.exe"')
Else
    MsgBox(0, "File Not Found!", $Dir & "\Hex2String.exe")
EndIf

Can you post your INI?

Are you running this from a UNC path? If so, you'll need to specify a local working directory.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Well I got no errors when I placed them in the right directory and ran a test.exe like this:

#NoTrayIcon
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("RunErrorsFatal", 0)

$Form1 = GUICreate("Convert", 262, 40, 193, 126)
$Button1 = GUICtrlCreateButton("Hex2String", 8, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
$Button2 = GUICtrlCreateButton("String2Hex", 136, 8, 121, 25, 0)
GUICtrlSetOnEvent(-1, "AButton2Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)

If FileExists("Credits.txt")
    FileOpen("Credits.txt", 2)
    FileWrite("Credits.txt", "Hex2String & String2Hex were created by Azkay"  & @CR _
            & "With help from the AutoIt Forum: http://www.autoitscript.com/forum/index.php" & @CR _
            & "MSN: Final_Fantasie_2@hotmail.com" & @CR & "EMAIL: Azkay.s@gmail.com")
    FileClose("Credits.txt")
EndIf

While 1
    Sleep(100)
WEnd

Func AButton1Click()
    If FileExists("Hex2String.exe") Then
        Run("Hex2String.exe")
    Else
        MsgBox(0, "Error", "Make sure Hex2String.exe is in your Converter directory")
    EndIf
EndFunc

Func AButton2Click()
    If FileExists("String2Hex.exe") Then
        Run("String2Hex.exe")
    Else
        MsgBox(0, "Error", "Make sure String2Hex.exe is in your Converter directory")
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc

Edit:

Also, isn't there already functions that for strings and hex (_StringToHex()/_HexToString()), what does yours do differently I'm curious :D ?

Changed to my other edit.

Mines just, erm, got a gui xD, So, Friends can use it and stuff, everyone I know is hopeless at any type of scripting/programing

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

What is the output of this?

$Dir = IniRead("Config.ini", "Directory", "Dir", "")
If FileExists($Dir & "\Hex2String.exe") Then
    Run('"' & $Dir & '\Hex2String.exe"')
Else
    MsgBox(0, "File Not Found!", $Dir & "\Hex2String.exe")
EndIf

Can you post your INI?

Are you running this from a UNC path? If so, you'll need to specify a local working directory.

Still want it?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I'll look at the other thing, but I screwed the above up... Look at the new edit I'm making...

Edit:

What are the contents of the ini file?

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

#13 ·  Posted (edited)

[Directory]

Dir=/Converter/

That is all xP

And, I just realized, when it converts from the hex, the spaces have been taken out of the string, but I only want them out of the hex. Though, theres probly no way to change this... Did that make sense?

EDIT::

Basically, I want it to split the hex, but not the string that it converts to

And On the otherone, I want it to, convert the string to hex, but with spaces on the hex, if I "Put this in" It shows up with the numbers liek this "102030" but I want it liek, "10 20 30", Oh, heres my code for those...

Hex2String>

#NoTrayIcon
#include <GUIConstants.au3>
#include <String.au3>
Opt("GUIOnEventMode", 1)
### Koda GUI section start ###
$Form1 = GUICreate("Hex2String", 666, 244, 193, 126)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 329, 209)
GUICtrlSetData($Edit1, "Hex Here")
$Edit2 = GUICtrlCreateEdit("", 336, 0, 329, 209)
GUICtrlSetData($Edit2, "String Here")
$Button1 = GUICtrlCreateButton("Convert Hex to String", 0, 216, 329, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
$Button2 = GUICtrlCreateButton("Copy String To Clipboard", 336, 216, 329, 25, 0)
GUICtrlSetOnEvent(-1, "AButton2Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW)
### Koda GUI section end   ###

While 1
    Sleep(100)
WEnd

Func AButton1Click()
    $Hex = GUICtrlRead($Edit1)
    $Split = StringStripWS($Hex, 8)
    $String = _HexToString($Split)
    GUICtrlSetData($Edit2, $String)
EndFunc

Func AButton2Click()
    ClipPut(GUICtrlRead($Edit2))
EndFunc

Func Quit()
    Exit
EndFunc
oÝ÷ Ù+kx6ì`µ«­¢+Ø(9½QÉå%½¸(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíMÑÉ¥¹¹ÔÌÐì)=ÁÐ ÅÕ½ÐíU%=¹Ù¹Ñ5½ÅÕ½Ðì°Ä¤(-½U$ÍÑ¥½¸ÍÑÉÐ(ÀÌØí½É´ÄôU%
ÉÑ ÅÕ½ÐíMÑÉ¥¹É!àÅÕ½Ðì°ØØØ°ÈÐаÄäÌ°ÄÈؤ(ÀÌØí¥ÐÄôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°À°À°ÌÈä°ÈÀä¤)U%
ÑɱMÑÑ ÀÌØí¥ÐÄ°ÅÕ½ÐíMÑÉ¥¹!ÉÅÕ½Ðì¤(ÀÌØí¥ÐÈôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°ÌÌØ°À°ÌÈä°ÈÀä¤)U%
ÑɱMÑÑ ÀÌØí¥ÐÈ°ÅÕ½Ðí!à!ÉÅÕ½Ðì¤(ÀÌØí   ÕÑѽ¸ÄôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí
½¹ÙÉÐMÑÉ¥¹Ñ¼!àÅÕ½Ðì°À°ÈÄØ°ÌÈä°ÈÔ°À¤)U%
ÑɱMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí ÕÑѽ¸Å
±¥¬ÅÕ½Ðì¤(ÀÌØí ÕÑѽ¸ÈôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí
½Áä!àQ¼
±¥Á½ÉÅÕ½Ðì°ÌÌØ°ÈÄØ°ÌÈä°ÈÔ°À¤)U%
ÑɱMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí ÕÑѽ¸É
±¥¬ÅÕ½Ðì¤)U%MÑ=¹Ù¹Ð ÀÌØíU%}Y9Q}
1=M°ÅÕ½ÐíEÕ¥ÐÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=¤(-½U$ÍÑ¥½¸¹()]¡¥±Ä(%M±À ÄÀÀ¤)]¹()Õ¹  ÕÑѽ¸Å
±¥¬ ¤($ÀÌØíMÑÉ¥¹ôU%
ÑɱI ÀÌØí¥ÐĤ($ÀÌØíMÁ±¥ÐôMÑÉ¥¹MÑÉ¥Á]L ÀÌØíMÑÉ¥¹°à¤($ÀÌØí!àô}MÑÉ¥¹Q½!à ÀÌØíMÁ±¥Ð¤(%U%
ÑɱMÑÑ ÀÌØí¥ÐÈ°ÀÌØí!à¤)¹Õ¹()Õ¹  ÕÑѽ¸É
±¥¬ ¤(%
±¥ÁAÕСU%
ÑɱI ÀÌØí¥ÐȤ¤)¹Õ¹()Õ¹EեР¤(%á¥Ð)¹Õ¹(
Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

$Dir = IniRead(@ScriptDir & "\Config.ini", "Directory", "Dir", "")
If FileExists(@ScriptDir & $Dir & "Hex2String.exe") Then
    Run('"' & @ScriptDir & $Dir & 'Hex2String.exe"')
Else
    MsgBox(0, "File Not Found!", $Dir & "Hex2String.exe")
EndIf
If $Dir = /Converter/ ... #1 the slashes look incorrect should be \Converter\... #2 try using @ScriptDir with it.

Edit:

Oh, and when you so when I look at your code, this is what it looks like it's looking for:

/Converter/\Hex2String.exe ... doesn't look right.

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

Hehe, Well, Now ive got the other problem, *points above* xD


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Guess theres no way to fix that problem?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I'm just curious on why you need the spaces taken out... and no, unless you store it in 2 different variables, "logically" speaking it doesn't sound like it's going to work.


[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

Well, the hex part, It takes out the spaces, cause if you input it liek "50 50 05" it errors, so the script changes it to "505005" but when it converts it to string, the sentence has no spaces


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Well, the hex part, It takes out the spaces, cause if you input it liek "50 50 05" it errors, so the script changes it to "505005" but when it converts it to string, the sentence has no spaces

What are you trying to do? I get no errors in converting from one to the other:

#include <string.au3>
$sHexed = _StringToHex('This is just a test string')
$sNonHex = _HexToString($sHexed)

MsgBox(64, 'Info', $sHexed & @CR & @CR & $sNonHex)oÝ÷ ØGb´-¹©eÊ;¬¶Ú-zËbµ«­¢+Ø9½QÉå%½¸(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíMÑÉ¥¹¹ÔÌÐì)=ÁÐ ÅÕ½ÐíU%=¹Ù¹Ñ5½ÅÕ½Ðì°Ä¤((ÀÌØí½É´ÄôU%
ÉÑ ÅÕ½ÐíMÑÉ¥¹É!àÅÕ½Ðì°ØØØ°ÈÐаÄäÌ°ÄÈؤ(ÀÌØí¥ÐÄôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°À°À°ÌÈä°ÈÀä¤)U%
ÑɱMÑÑ ÀÌØí¥ÐÄ°ÅÕ½ÐíMÑÉ¥¹!ÉÅÕ½Ðì¤(ÀÌØí¥ÐÈôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°ÌÌØ°À°ÌÈä°ÈÀä¤)U%
ÑɱMÑÑ ÀÌØí¥ÐÈ°ÅÕ½Ðí!à!ÉÅÕ½Ðì¤(ÀÌØí   ÕÑѽ¸ÄôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí
½¹ÙÉÐMÑÉ¥¹Ñ¼!àÅÕ½Ðì°À°ÈÄØ°ÌÈä°ÈÔ°À¤)U%
ÑɱMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí ÕÑѽ¸Å
±¥¬ÅÕ½Ðì¤(ÀÌØí ÕÑѽ¸ÈôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí
½¹ÙÉÐ!àѼMÑÉ¥¹ÅÕ½Ðì°ÌÌØ°ÈÄØ°ÌÈä°ÈÔ°À¤)U%
ÑɱMÑ=¹Ù¹Ð ´Ä°ÅÕ½Ðí ÕÑѽ¸É
±¥¬ÅÕ½Ðì¤)U%MÑ=¹Ù¹Ð ÀÌØíU%}Y9Q}
1=M°ÅÕ½ÐíEÕ¥ÐÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=¤()]¡¥±Ä(M±À ÄÀÀ¤)]¹()Õ¹ ÕÑѽ¸Å
±¥¬ ¤(U%
ÑɱMÑÑ ÀÌØí¥ÐÈ°}MÑÉ¥¹Q½!à¡U%
ÑɱI ÀÌØí¥ÐĤ¤¤)¹Õ¹()Õ¹   ÕÑѽ¸É
±¥¬ ¤($U%
ÑɱMÑÑ ÀÌØí¥ÐÈ°}!áQ½MÑÉ¥¹¡U%
ÑɱI ÀÌØí¥ÐĤ¤¤(í
±¥ÁAÕСU%
ÑɱI ÀÌØí¥ÐȤ¤)¹Õ¹()Õ¹EեР¤(á¥Ð)¹Õ¹
Using your own GUI, changed the button name and commented out ClipPut. 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

But, your not using split string on the hex, because, If im copying a large amount of hex, it all has spaces between it, I dont want to go through, and take out the spaces, so I used the split function to take out the spaces from the hex then convert that. or else, I get an error, because of the spaces


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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