1

I want my Inno Setup Script to search for my setup's .TMP file which usually creates in currently logged user's Local Application Data folder and give user a message box saying "Your Setup's Temporary Source seems to be created successfully."

I wrote a code to do so:

 if CurPageID = wpLicence then begin
   if FileExists((ExpandConstant('{localappdata}\Temp\is-*****.tmp\MySetup.tmp'))) then begin
     MsgBox('Your Setup''s Temporary Source seems to be created successfully.', mbInformation, MB_OK);
     MsgBox('It is located in: <<I WANT TO GET THE FOUND FILE''S FULL PATH HERE>>', mbWarning, MB_OK);
   end;
 end; 

But, even my setup's temporary file (MySetup.tmp) exists when the setup starts, I'm not getting those message boxes.

What is the problem in this code?

Is the is-***** ignored when searching?

UPDATED QUESTION

I mean The Temporary Directory shown in below image. It contains the internal Temporary File of the Setup Wizard. This is usually named like {#SetupName}.tmp......this Temporary Directory. Not the other Temporary Directory which Inno Setup extracts Files of the Setup. such as ISSKin.dll or any externally used files.

Any help would be greatly appreciated.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Blueeyes789
  • 543
  • 6
  • 18

1 Answers1

0

The FileExists function does not support wildcards, not even in a file name, let alone in a name of a parent folder.

See How to test using wildcards whether a file exists in Inno Setup.


Though in your case, just use the ParamStr(0).

FileExists(ParamStr(0))
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • I tried those also........But the problem is Inno Setup thinks `tmp` as the Directory which Temporary Files are extracted to. Not the Temporary Folder which has the Setup Source File..........I shown this in a image...........See my Updated Question. – Blueeyes789 Jul 27 '16 at 07:08
  • OK, I see. In that case your question is duplicate to the question linked in my answer (as there's no better way). Unless you tell us what are you really trying to achieve (as I cannot image you really want to bother the end user with some info about some temporary folder). – Martin Prikryl Jul 27 '16 at 07:23
  • I added MsgBoxes for testing purpose, I really want it to rename `Setup.tmp` to `Setup.exe` for a while and immediately rename it back to original name when Installation finishes...... – Blueeyes789 Jul 27 '16 at 07:27
  • See my update answer + The .tmp is running the script (not the .exe), and you cannot rename a running application. – Martin Prikryl Jul 27 '16 at 07:32
  • + You still didn't tell us what are you trying to do. All these are some intermediate steps to some mysterious goal. And as such likely an [XY problem](http://meta.stackexchange.com/q/66377/218578). – Martin Prikryl Jul 27 '16 at 07:33
  • sh-Parameter? I never heard about this! Will `FileExists(ParamStr(0))` detect ``Setup.tmp` , the actual setup prgram? – Blueeyes789 Jul 27 '16 at 07:40
  • The `ParamStr(0)` returns `C:\Users\martin\AppData\Local\Temp\is-L6ES8.tmp\mysetup.tmp`. Just try it. – Martin Prikryl Jul 27 '16 at 07:43
  • I tried......It works Thank you., Even though it is impossible to rename it, can I use `RENAME (ParamStr(0)) Setup.exe` as a parameter for `ShellExec 'Open' 'CMD.exe'`? – Blueeyes789 Jul 27 '16 at 07:50
  • You can, but it will fail. Again, you cannot rename a running application. What are you trying to do? – Martin Prikryl Jul 27 '16 at 07:58
  • Because I made a Installer for my Old PC backup files.................Whose are likely 89 GB or more. Then I added it also a notification area icon as I did to an Application made by me to notify which file is being copied at current time. Then when icon appears in Notification Area Icons Control Panel it showng as `MySetup.tmp`..............It looks very ugly.....That's why I asked to rename it anyway even for a while and make it appear like `MySetup.`. :\ – Blueeyes789 Jul 27 '16 at 08:03
  • The file name shown there will be the name of the binary at the time of its execution. Renaming it later (even if possible), won't change the name shown in control panel. – Martin Prikryl Jul 27 '16 at 08:14
  • You can of course create a standalone executable just for a purpose of displaying the tray icon. And you can name that anything you like. – Martin Prikryl Jul 27 '16 at 08:15
  • I will try to build my own, but I like to ask can I find the function or procedure in Inno Setup source code which changes wizard displayer(setup.e32) to `my installer's name.tmp`? Is there any function doing it? A file can't be renamed without giving any command...... :( – Blueeyes789 Jul 27 '16 at 08:30
  • I do not know. Just search the code for the name. If you do not find anything, ask a new question. – Martin Prikryl Jul 27 '16 at 08:35