TrickyDeath Posted September 10, 2014 Share Posted September 10, 2014 Hello everyone, i do have a simple question what i do not realy understand what hapend and why. I did made a small program, what is converting Valuta prices to other type, cause i got tired of use all the time google for it. After that i "convert" it into an exe file. All the Valute prices are in INI file, and work perfect. I did made another small script (Tray menu) and then when i click on the proper TrayItem it should run the Valute exchanger exe file, but something is wrong. The exe is running, but when i calculate with it, it give me only 0 resoults. If i run the exe manualy it is work properly. How does it come, from Tray menu item wont work, and from manualy run it work hot it have to work? Case $iValutaCalculator Run("C:\Users\asd\Desktop\EU_USD.exe") Best Regards, Tricky Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
BrewManNH Posted September 10, 2014 Share Posted September 10, 2014 You must realize that you haven't given us nearly enough information to answer this question? You need to post your code, or at least a reproducer script that demonstrates what you're doing and that shows the same problem. One run command isn't going to do it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 10, 2014 Moderators Share Posted September 10, 2014 TrickyDeath,Without sight of the 2 scripts it is difficult to say much. But do you display the result within the EU_USD file - or are you expecting the calling script to do this? If the latter, how are you passing the necessary data between the two processes? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution TrickyDeath Posted September 11, 2014 Author Solution Share Posted September 11, 2014 (edited) Sorry, both of you have right. At work i take a look on the source code, cause i could saw the calculator can not see the INI file somehow. Problem solved after i insert @ScriptDir infront of the ini file in IniRead. Source Codes TrayMenu: expandcollapse popup#include <MsgBoxConstants.au3> #NoTrayIcon Opt("TrayMenuMode", 3) TraySetState(1) TraySetToolTip("Programs") Local $iAddons = TrayCreateMenu("Addons") Local $iValutaCalculator = TrayCreateItem("Valuta Calculator", $iAddons) Local $iCalculator = TrayCreateItem("Calculator", $iAddons) Local $iNotepad = TrayCreateItem("Notepad", $iAddons) Local $iExcel = TrayCreateItem("Excel", $iAddons) TrayCreateItem("") Local $iAbout = TrayCreateItem("About") TrayCreateItem("") Local $iExit = TrayCreateItem("Exit") TraySetState(1) While 1 Switch TrayGetMsg() Case $iValutaCalculator Run(@DesktopDir & "\EU_USD.exe") Case $iCalculator Run(@SystemDir & "\calc.exe") Case $iNotepad Run(@SystemDir & "\notepad.exe") Case $iExcel ;@ProgramFilesDir Run("c:\Program Files (x86)\Microsoft Office\Office\EXCEL.EXE") Case $iExit Exit EndSwitch WEnd Source of calculator: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> $myForm = GUICreate("Change EU - USD - GBP", 610, 125) ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $EUROtoEURO = IniRead(@ScriptDir & "\ValutaPrices.ini", "EURO", "EURO", "0") $EUROtoUSD = IniRead(@ScriptDir & "\ValutaPrices.ini", "EURO", "USD", "0") $EUROtoGBP = IniRead(@ScriptDir & "\ValutaPrices.ini", "EURO", "GBP", "0") $USDtoEURO = IniRead(@ScriptDir & "\ValutaPrices.ini", "USD", "Euro", "0") $USDtoUSD = IniRead(@ScriptDir & "\ValutaPrices.ini", "USD", "USD", "0") $USDtoGBP = IniRead(@ScriptDir & "\ValutaPrices.ini", "USD", "GBP", "0") $GBPtoEURO = IniRead(@ScriptDir & "\ValutaPrices.ini", "GBP", "EURO", "0") $GBPtoUSD = IniRead(@ScriptDir & "\ValutaPrices.ini", "GBP", "USD", "0") $GBPtoGBP = IniRead(@ScriptDir & "\ValutaPrices.ini", "GBP", "GBP", "0") ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $LabelFrom = GUICtrlCreateLabel("From :", 10, 30) $LabelAmount = GUICtrlCreateLabel("Amount :", 130, 30) $LabelValuta = GUICtrlCreateLabel("To :", 250, 30) $LabelPrice = GUICtrlCreateLabel("Price :", 370, 30) $SelectValuta_From = GUICtrlCreateCombo("", 10, 55, 115, 40) $Amount = GUICtrlCreateInput("0", 130, 55, 115, 40) $SelectValuta = GUICtrlCreateCombo("", 250, 55, 115, 40) $Price = GUICtrlCreateInput("", 370, 55, 100, 40, $ES_READONLY) $Btn_Calculate = GUICtrlCreateButton("Calculate", 480, 55, 120, 40) GUICtrlSetFont($SelectValuta, 16) GUICtrlSetFont($SelectValuta_From, 16) GUICtrlSetFont($Amount, 16) GUICtrlSetFont($Price, 16) GUICtrlSetFont($Btn_Calculate, 16) GUICtrlSetData($SelectValuta_From, "EURO|USD|GBP", "EURO") GUICtrlSetData($SelectValuta, "EURO|USD|GBP", "EURO") GUICtrlSetBkColor($Price, 0xFFFFFF) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit Switch $msg Case $Btn_Calculate $ReadAmount = GUICtrlRead($Amount) $ReadValuta_From = GUICtrlRead($SelectValuta_From, 1) $ReadValuta = GUICtrlRead($SelectValuta, 1) If $ReadValuta_From = "EURO" And $ReadValuta = "EURO" Then GUICtrlSetData($Price, $ReadAmount * $EUROtoEURO) EndIf If $ReadValuta_From = "EURO" And $ReadValuta = "USD" Then GUICtrlSetData($Price, $ReadAmount * $EUROtoUSD) EndIf If $ReadValuta_From = "EURO" And $ReadValuta = "GBP" Then GUICtrlSetData($Price, $ReadAmount * $EUROtoGBP) EndIf ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If $ReadValuta_From = "USD" And $ReadValuta = "EURO" Then GUICtrlSetData($Price, $ReadAmount * $USDtoEURO) EndIf If $ReadValuta_From = "USD" And $ReadValuta = "USD" Then GUICtrlSetData($Price, $ReadAmount * $USDtoUSD) EndIf If $ReadValuta_From = "USD" And $ReadValuta = "GBP" Then GUICtrlSetData($Price, $ReadAmount * $USDtoGBP) EndIf ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If $ReadValuta_From = "GBP" And $ReadValuta = "EURO" Then GUICtrlSetData($Price, $ReadAmount * $GBPtoEURO) EndIf If $ReadValuta_From = "GBP" And $ReadValuta = "USD" Then GUICtrlSetData($Price, $ReadAmount * $GBPtoUSD) EndIf If $ReadValuta_From = "GBP" And $ReadValuta = "GBP" Then GUICtrlSetData($Price, $ReadAmount * $GBPtoGBP) EndIf EndSwitch WEnd Maybe the way, how i made it, is kinda prehistoric, but work fine. I could put them in an array... :/ Edit: It was just like this: $EUROtoEURO = IniRead("ValutaPrices.ini", "EURO", "EURO", "0") Cause the exe and the INI was next to each others, but still do not understand why did not work, if i run it from that TrayMenu and why did it work if i just run the calculator itself. Somehow loesing the dir path or something? I am just guessing, cause i am still just a newbie in programing / scripting. Edited September 11, 2014 by TrickyDeath Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
jguinch Posted September 11, 2014 Share Posted September 11, 2014 (edited) another way to solve this would have been the set the WorkingDir parameter in Run in your traymenu code Edited September 11, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
TrickyDeath Posted September 11, 2014 Author Share Posted September 11, 2014 It is same as @ScriptDir or just type the full path. Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
TrickyDeath Posted September 13, 2014 Author Share Posted September 13, 2014 Does it posible to somehow set the traymenu "slide/open" side? Cause it is seams ugly, when it is open to left side, then submenu open to right side, and cover the main menu. Just ugly. Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
TrickyDeath Posted September 14, 2014 Author Share Posted September 14, 2014 another way to solve this would have been the set the WorkingDir parameter in Run in your traymenu code Ohh BTW the problem was not that the run order not run the calculator, the problem was, after it run, the calculator wont see anymore the INI file, where are the prices stored. :/ Still do not know why it is that. Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :) [u]Tricky[/u] You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei) Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 15, 2014 Share Posted September 15, 2014 Ohh BTW the problem was not that the run order not run the calculator, the problem was, after it run, the calculator wont see anymore the INI file, where are the prices stored. :/ Still do not know why it is that. When you don't specify a full path the working directory will be used, and it was obviously not where you needed it to be. So in this case you fixed it by giving the full path, but setting the right working directory as jguinch said would have also worked. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now